@zhike/logger
A logger has following features:
Last updated a year ago by zxdvd .
ISC · Original npm · Tarball · package.json
$ cnpm install @zhike/logger 
SYNC missed versions from official npm registry.

A logger has following features:

*. support log to console, file, elasticsearch, kafka, sentry
*. log to file support rotating by time
*. customized formatter
*. supported levels: fatal, error, warning, info, debug

Demo

const logger = new Logger({
  console: {},
  elasticsearch: {
    endpoint: '172.16.3.2:19200',           // es server endpoint
    defaultIndex: 'demo',                   // default target index
    level: 'warning',                       // log level under warning is supressed
  },
  file: {
    rotateFilename: '[logs/demo_]YYYY-MM-DD[.log]',     // rotate by day
    level: 'info',                          // log level under info is supressed
  },
}, {
  basicInfo: { project: 'crm' },
})

logger.debug('debug 1')
logger.info('info 1')
logger.info('info 2')
// log to es with index 'demo1' but not default 'demo'
logger.error('error 1', { index__: 'demo1' })

Current Tags

  • 0.0.4                                ...           latest (a year ago)

4 Versions

  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |