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 = 'ceo-logger';log // info: OK
Pass Meta Data
var log = 'ceo-logger' some:"metadata" ;log // info: OK some=metadata
Output Json Data
var log = 'ceo-logger' some:"metadata" true;log // { "some": "metadata", "level": "info", "message": "OK" }
Set Logging Level
var log = 'ceo-logger' some:"metadata" true 'debug'; // default is 'info'log // { "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=LogEntriesKeyloggly=LogglyKeymongo=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
logdebug = winstonloginfo = winstonlognotice = winstonlogwarning = winstonlogerr = winstonlogcrit = winstonlogalert = winstonlogemerg = winston // matching aliasesloginformation = winston // informational messagelogwarn = winston // warning conditionslogerror = winston // error conditionslogcritical = winston // critical conditionslogemergency = winston // system is unusable // remapped alternativeslogtrace = winston // debug-level messagelogsilly = winston // debug-level messagelogverbose = winston // informational message