meh-activity-transport

0.11.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i meh-activity-transport

Weekly Downloads

45

Version

0.11.0

License

MIT

Unpacked Size

12.8 kB

Total Files

6

Last publish

Collaborators

  • jimghg
  • meh-greenhouse
  • lukevdpalen
  • rickstv
  • iamrobin
  • josvdmanakker
  • kreumkens
  • shanevdb