diff --git a/README.md b/README.md index d65a752..f674bc0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ #Ledger -Ledger is an event based NodeJS module used for logging events to stdout, files or MongoDB. +Ledger is an event based NodeJS module used for logging to various locations. -By default Ledger can overwrite `console.log`, `console.info`, `console.warn` and `console.error` to allow all output to be either colorized or outputted to a file or a MongoDB server. +By default Ledger can overwrite `console.log`, `console.info`, `console.warn` and `console.error` to allow all output, even output from other modules. ##Installation: @@ -11,12 +11,11 @@ npm install ledger ##Usage: ``` -//this will output to stdout/stderr -//ledger.log and MongoDB listening at 127.0.0.1 -var ledger = (require('ledger')({ - logFile: 'ledger.log', - logDb: true, -}); +//this will output all messages to the file "my/file.log" +var ledger = (require('ledger'); +var logger = ledger.createLogger( {}, [ + new ledger.transactions.file( { logFile: 'my/file.log' } ), +]); ledger.on('log::error', function(time, msg){ //do something special with errors @@ -34,18 +33,8 @@ console.error('error'); ##Options: -* `useColor`: Boolean //whether to colorize stdout/stderr, Default: true * `separator`: String //separator used when building messages, Default: ' > ' * `timeFormatter`: Function(date) //function used when formatting Date object to a string, Default: function(date){ return date.toString(); } -* `logStdout`: Boolean //whether or not to print to stdout/stderr, Default: true -* `logFile`: String //file to log all messages to, Default: false -* `logDb`: Boolean //whether or not to log to a MongoDB server, Default: false -* `dbHost`: String //host of MongoDB server, Default: '127.0.0.1' -* `dbPort`: String //port that MongoDB server is listengin on, Default: '27017' -* `dbName`: String //name of MongoDB database, Default: 'ledger' -* `dbCollection`: String //name of collection to store messages in, Default: 'log' -* `dbUser`: String //username to use when connecting to MongoDB server, Default: false -* `dbPass`: String //password used to connect to MongoDB server, Default: false ##Methods: @@ -55,7 +44,9 @@ console.error('error'); * `warn(msg)` //mapped to console.warn * `error(msg)` //mapped to console.error * `now()` //get the current time using timeFormatter setting - +* `_log(msg,parts)` // raw logging, do not use + + ##Events: * `log::log`: (time, msg) //event that gets called after a call to console.log