I am using the library here to log to Stackdriver from Node.js. However, the logs aren't showing up - I think because I'm not specifying a metadata resource, such as 'global'. How do I do that?
var winston = require('winston');
var transport = require('@google-cloud/logging-winston');
winston.add(transport, {
projectId: 'myproject',
keyFilename: 'google_key.json',
level: 'warn' // log at 'warn' and above
});
winston.error('warp nacelles offline');
The solution is to add a 'label' field to the configuration, like so:
winston.add(transport, {
projectId: 'myproject',
keyFilename: 'google_key.json',
level: 'warn', // log at 'warn' and above,
label: 'Global'
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With