meh-activity-transport
v0.11.0
Published
```js import winston from 'winston' import ActivityTransport from 'meh-activity-transport'
Downloads
100
Keywords
Readme
Winston Transport to incorporate MEH activity logger plugin in Winston
import winston from 'winston'
import ActivityTransport from 'meh-activity-transport'
const logger = winston.createLogger({
levels: ActivityTransport.utils.levelsWithTracking,
format: combine(
timestamp(),
label({ /* label: CLIENT_NAME */}} }), // e.g. client name
errors({ stack: true }),
),
transports: [
new winston.transports.Console(),
new ActivityTransport({
tid = 'UA-XXXXXXXX-X' , /* optional */
clientId = 'Frank S' /* optional */
level: ActivityTransport.utils.levelName
})
]
});
Important
when using format.cli()
or any other colorized format please add the color for the track
log level
winston.addColors({
[ActivityTransport.utils.logLevelName]: 'green',
...winston.config.npm.colors,
});
How to use the tracker
logger.track('action to track', {
label?: string,
value?: int,
priority?: int
})
What and how Winston does work.
https://github.com/winstonjs/winston/blob/master/README.md
What is transport
https://github.com/winstonjs/winston/blob/master/docs/transports.md