From 222c86341df7cb8065d6fa0f78de50a445db2e4b Mon Sep 17 00:00:00 2001 From: zizifn <515868058@qq.com> Date: Thu, 26 May 2022 08:39:03 +0800 Subject: [PATCH] update documentation for #2114 (#2138) Co-authored-by: zizifn & wbt --- README.md | 3 +++ UPGRADE-3.0.md | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5acb85730..8f9beafe5 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,9 @@ if (process.env.NODE_ENV !== 'production') { You may also log directly via the default logger exposed by `require('winston')`, but this merely intended to be a convenient shared logger to use throughout your application if you so choose. +Note that the default logger doesn't have any transports by default. +You need add transports by yourself, and leaving the default logger without any +transports may produce a high memory usage issue. ## Table of contents diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 02901636c..1f2951e33 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -24,6 +24,8 @@ - `winston.Logger` has been replaced with `winston.createLogger`. - `winston.setLevels` has been removed. Levels are frozen at the time of Logger creation. - Setting the level on the default `winston` logger no longer sets the level on the transports associated with the default `winston` logger. +- The default logger exposed by `require('winston')` no longer has default `Console` transports, +and leaving it without transports may cause a high memory usage issue. ### Transports - `winston.transports.Memory` was removed. Use any Node.js `stream.Writeable` with a large `highWaterMark` instance instead. @@ -39,7 +41,8 @@ - `debugStdout` option has been removed. ### `winston.Container` and `winston.loggers` -- `winston.Container` instances no longer have default `Console` transports +- `winston.Container` instances no longer have default `Console` transports. +Failing to add any transports may cause a high memory usage issue. - `winston.Container.prototype.add` no longer does crazy options parsing. Implementation inspired by [segmentio/winston-logger](https://github.com/segmentio/winston-logger/blob/master/lib/index.js#L20-L43) ### `winston.Logger`