You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -200,10 +200,16 @@ Every incoming log message runs through a number of steps before being displayed
200
200
-**log message** Log message comes in through the `BaseLogger.log()` method
201
201
-**mask** If masking is configured, log message gets recursively masked
202
202
-**toLogObj** Log message gets transformed into a log object: A default typed log object can be passed to constructor as a second parameter and will be cloned and enriched with the incoming log parameters. Error properties will be handled accordingly. If there is only one log property, and it's an object, both objects (cloned default `logObj` as well as the log property object) will be merged. If there are more than one, they will be put into properties called "0", "1", ... and so on. Alternatively, log message properties can be put into a property with a name configured with the `argumentsArrayName` setting.
203
-
-**addMetaToLogObj** Additional meta information, like the source code position of the log will be gathered and added to the `_meta` property or any other one configured with the setting `metaProperty`.
203
+
-**addMetaToLogObj** Additional meta information, like date, runtime and source code position of the log will be gathered and added to the `_meta` property or any other one configured with the setting `metaProperty`.
204
204
-**format** In case of "pretty" configuration, a log object will be formatted based on the templates configured in settings. Meta will be formatted by the method `_prettyFormatLogObjMeta` and the actual log payload will be formatted by `prettyFormatLogObj`. Both steps can be overwritten with the settings `formatMeta` and `formatLogObj`.
205
205
-**transport** Last step is to "transport" a log message to every attached transport from the setting `attachedTransports`. Last step is the actual transport, either JSON (`transportJSON`), formatted (`transportFormatted`) or omitted, if its set to "hidden". Both default transports can also be overwritten by the corresponding setting.
206
206
207
+
### ❗Performance
208
+
209
+
By default, `tslog is optimized for the best developer experience and includes some default settings that may impact performance in production environments. `
210
+
To ensure optimal performance in production, we recommend modifying these settings, such as `hideLogPositionForProduction`(s. below), as needed.
211
+
212
+
207
213
### Default log level
208
214
209
215
`tslog` comes with default log level `0: silly`, `1: trace`, `2: debug`, `3: info`, `4: warn`, `5: error`, `6: fatal`.
### RequestID: Mark a request (e.g. HTTP) call with AsyncLocalStorage and `tslog`
714
727
>**Node.js 13.10 introduced a new feature called <ahref="https://nodejs.org/api/async_hooks.html#async_hooks_class_asynclocalstorage"target="_blank">AsyncLocalStorage.</a>**<br>
715
728
716
-
**❗ Keep track of all subsequent calls and promises originated from a single request (e.g. HTTP).**
729
+
** Keep track of all subsequent calls and promises originated from a single request (e.g. HTTP).**
717
730
718
731
In a real world application a call to an API would lead to many logs produced across the entire application.
719
732
When debugging it can be quite handy to be able to group all logs based on a unique identifier, e.g. `requestId`.
0 commit comments