Giter Site home page Giter Site logo

winston-mongodb-wt's Introduction

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
}

winston-mongodb-wt's People

Contributors

why520crazy avatar

Stargazers

 avatar

Watchers

Anytao avatar Yanlong Wang avatar 李会军 avatar 贺天卓 avatar James Cloos avatar Nicolas Xu avatar 刘浩 avatar Wang Hao avatar 龚林杰 avatar  avatar Lyf avatar 马传佳 avatar 甄帅 avatar  avatar Walker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.