Skip to content

Commit

Permalink
[doc] Add example of logging to a transport with the level option.
Browse files Browse the repository at this point in the history
  • Loading branch information
coderarity committed May 6, 2012
1 parent 19a2899 commit 16dc3a9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ Setting the level for your logging message can be accomplished in one of two way
winston.info("127.0.0.1 - there's no place like home");
```

Winston allows you to set a `level` on each transport that specifies the level of messages this transport should log. For example, you could log only errors to the console, with the full logs in a file:

``` js
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({ level: 'error' }),
new (winston.transports.File)({ filename: 'somefile.log' })
]
});
```

As of 0.2.0, winston supports customizable logging levels, defaulting to [npm][0] style logging levels. Changing logging levels is easy:

``` js
Expand Down

0 comments on commit 16dc3a9

Please sign in to comment.