Loggly with Winston Dynamic Installs dynamically

I am 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 seems that the tags are set to initialize winston.add , but what if I want to dynamically set some tag when sending a message to the log?

+5
source share
1 answer

According to the winston-loggly-bulk source, you can include tags in the metadata of a logging command using the tags property. For instance:

 logger.log('info', 'Server starting up.', { tags: 'server' }); 

The value can be either a single tag or an array , for example:

 logger.log('info', 'Server starting up.', { tags: ['server', 'startup'] }); 
0
source

All Articles