Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,11 @@ winston.info("127.0.0.1 - there's no place like home");
```

`winston` allows you to define a `level` property on each transport which
specifies the **maximum** level of messages that a transport should log. For
example, using the `syslog` levels you could log only `error` messages to the
console and everything `info` and below to a file (which includes `error`
messages):
specifies the **maximum** level (that is, the minimum severity, as explained
on Logging Levels above) of messages that a transport should log. For
example, using the `npm` levels you could log only `error` messages to the
console and everything `info` and below (which includes `error`
messages, but will exclude eg. http and verbose) to a file :

``` js
const logger = winston.createLogger({
Expand All @@ -590,6 +591,10 @@ const logger = winston.createLogger({
})
]
});

logger.debug('Will not be logged in either transport!');
logger.info('Will be logged only in File!');
logger.error('Will be logged by both transports!');
```

You may also dynamically change the log level of a transport:
Expand Down Expand Up @@ -1268,4 +1273,4 @@ npm test
[Charlie Robbins]: http://github.com/indexzero
[Jarrett Cruger]: https://github.com/jcrugzz
[David Hyde]: https://github.com/dabh
[Chris Alderson]: https://github.com/chrisalderson
[Chris Alderson]: https://github.com/chrisalderson