1.1.2 • Published 8 years ago

winston-mongodb-wt v1.1.2

Weekly downloads
5
License
ISC
Repository
github
Last release
8 years ago

winston-mongodb for wt

参考:https://github.com/winstonjs/winston-mongodb

  1. 支持log和error 日志的分开存储
  2. 支持错误信息 pub 到 redis中

安装

执行 npm i winston-mongodb-wt --save

Usage

 var winston = require('winston');

 /**
  * Requiring `winston-mongodb-wt` will expose
  * `winston.transports.MongoDB`
  */
 require('winston-mongodb-wt').MongoDB;

 winston.add(winston.transports.MongoDB, options);

options 参数说明

  1. level: 错误级别, 默认 'info'.
  2. db: mongodb 连接字符串.
  3. collection:默认日志表的集合,默认为 log
  4. errorCollection:错误日志表存储的集合,默认和collection相同
  5. options: MongoDB connection parameters (optional, defaults to {db: {native_parser: true}, server: {poolSize: 2, socketOptions: {autoReconnect: true}}}).
  6. storeHost: Boolean indicating if you want to store machine hostname in logs entry, if set to true it populates MongoDB entry with 'hostname' field, which stores os.hostname() value.
  7. label: 存储在Log表中,可以作为 app name 区分日志.
  8. name: Transport instance identifier. Useful if you need to create multiple MongoDB transports.
  9. redis,level为error pub到 redis 中去,格式为:
redis:{
    port:xxx,
    host:xxx,
    password:xxx,
    options:xxx
    channel:xxx,//默认logError
}
1.1.2

8 years ago

1.1.1

9 years ago

1.1.0

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago