I'm using loggly with node js. This is the initialization script:
var winston = require('winston');
require('winston-loggly-bulk');
winston.add(winston.transports.Loggly, {
inputToken: "TOKEN",
subdomain: "SUBDOMAIN",
tags: ["Winston-NodeJS"],
json:true
});
It looks like the tags are set on winston.add
initialization, but what if I want to set some tag dynamically when I send a message to the logger?
According to the winston-loggly-bulk source, it is possible to include tags in the metadata of the logging instruction using the tags
property. For example:
logger.log('info', 'Server starting up.', { tags: 'server' });
The value can be either a single tag or an array, like this:
logger.log('info', 'Server starting up.', { tags: ['server', 'startup'] });
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