From 12e966bcbbb97acaecaf2047e55308497595d944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva=20de=20Jesus?= Date: Mon, 9 Jun 2025 21:53:26 -0300 Subject: [PATCH 1/2] update log level explanation on README.md to make slightly clearer --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 69be33546..9031821bd 100644 --- a/README.md +++ b/README.md @@ -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({ @@ -1268,4 +1269,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 \ No newline at end of file +[Chris Alderson]: https://github.com/chrisalderson From dc7b986d3711757f178e74032200c13b4d3afdac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva=20de=20Jesus?= Date: Mon, 9 Jun 2025 22:19:25 -0300 Subject: [PATCH 2/2] add more code examples in the level filter on the README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 9031821bd..aff33f829 100644 --- a/README.md +++ b/README.md @@ -591,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: