Git Product home page Git Product logo

ceo-logger's Introduction

ceo-logger

Auto configuring Winston logger supporting logentries, loggly, mongo, riak, simpledb, syslog and defaulting to console

Install

npm i ceo-logger --save

Basic Usage

basic.js example, defaults to console

var log = new require('ceo-logger')();
log.info('OK') // info: OK

Pass Meta Data

var log = new require('ceo-logger')({ some:"metadata" });
log.info('OK') // info: OK some=metadata

Output Json Data

var log = new require('ceo-logger')({ some:"metadata" }, true);
log.info(logging) // { "some": "metadata", "level": "info", "message": "OK" }

Set Logging Level

var log = new require('ceo-logger')({ some:"metadata" }, true, 'debug'); // default is 'info'
log.debug(logging) // { "some": "metadata", "level": "info", "message": "OK" }

CLI Usage

node basic.js --logentries LogEntriesKey
# logging goes to LogEntries

or via environment variable

logentries=LogEntriesKey

node basic.js
# logging goes to LogEntries

Send to multiple places

logentries=LogEntriesKey
loggly=LogglyKey
mongo=MongoConnectString

node basic.js
# logging goes to LogEntries, Loggly and MongoDb

or config as JSON

node basic.js --ceo-logger '{"logentries":"key", "loggly":"key", "mongo":"connectionString"}'
# logging goes to LogEntries, Loggly and MongoDb

or config as JSONIC

node basic.js --ceo-logger 'logentries:key,loggly:key'
# logging goes to LogEntries and Loggly

Log Functions and Alias

In order to maximize compatibility the following are supported

log.debug   = winston.debug(message)
log.info    = winston.info(message)
log.notice  = winston.notice(message)
log.warning = winston.warning(message)
log.err     = winston.err(message)
log.crit    = winston.crit(message)
log.alert   = winston.alert(message)
log.emerg   = winston.emerg(message)

// matching aliases
log.information = winston.info(message) // informational message
log.warn        = winston.warning(message) // warning conditions
log.error       = winston.err(message) // error conditions
log.critical    = winston.crit(message) // critical conditions
log.emergency   = winston.emerg(message) // system is unusable

// remapped alternatives
log.trace   = winston.debug(message) // debug-level message
log.silly   = winston.debug(message) // debug-level message
log.verbose = winston.info(message) // informational message

License MIT

ceo-logger's People

Contributors

yieme avatar

Watchers

 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.