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
@@ -140,6 +140,9 @@ logger.fatal(new Error("I am a pretty Error with a stacktrace."));
140
140
141
141
## API documentation
142
142
143
+
> **`tslog >= v4` is a major rewrite and introduces breaking changes.** <br>
144
+
> Please, follow this documentation when migrating.
145
+
143
146
### <aname="life_cycle"></a>Lifecycle of a log message
144
147
145
148
Every incoming log message runs through a number of steps before being displayed or handed over to a "transport". Every step can be overwritten and adjusted.
@@ -162,7 +165,7 @@ Every incoming log message runs through a number of steps before being displayed
> **`tslog` follows a semantic release policy.** A major version change indicates breaking changes.<br><br>
556
+
> `tslog >=4` is less limiting when it comes to configuration. There are many use cases (especially when it comes to integration with 3rd party services) that now can be achieved elegantly and were not possible before.
557
+
558
+
### Name and other constructor parameters
559
+
560
+
`tslog` < 4 had a name parameter on the constructor. v4 removed all preconfigured parameters and allows you to create your own log object (s. "Defining and accessing `logObj`").
### Tip: RequestID: Mark a request (e.g. HTTP) call with AsyncLocalStorage and `tslog`
573
+
### RequestID: Mark a request (e.g. HTTP) call with AsyncLocalStorage and `tslog`
552
574
>**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>
553
575
554
576
**❗ Keep track of all subsequent calls and promises originated from a single request (e.g. HTTP).**
@@ -140,6 +140,9 @@ logger.fatal(new Error("I am a pretty Error with a stacktrace."));
140
140
141
141
## API documentation
142
142
143
+
> **`tslog >= v4` is a major rewrite and introduces breaking changes.** <br>
144
+
> Please, follow this documentation when migrating.
145
+
143
146
### <aname="life_cycle"></a>Lifecycle of a log message
144
147
145
148
Every incoming log message runs through a number of steps before being displayed or handed over to a "transport". Every step can be overwritten and adjusted.
@@ -148,7 +151,7 @@ Every incoming log message runs through a number of steps before being displayed
148
151
149
152
-**log message** Log message comes in through the `BaseLogger.log()` method
150
153
-**mask** If masking is configured, log message gets recursively masked
151
-
-**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.
154
+
-**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.
152
155
-**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`.
153
156
-**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 `formatMeta`.
154
157
-**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.
@@ -157,12 +160,12 @@ Every incoming log message runs through a number of steps before being displayed
157
160
158
161
`tslog` comes with default log level `0: silly`, `1: trace`, `2: debug`, `3: info`, `4: warn`, `5: error`, `6: fatal`.
159
162
160
-
> **Tip:** Each logging method has a return type, which is a _JSON_ representation of the log message (`ILogObject`).
163
+
> **Tip:** Each logging method has a return type, which is a _JSON_ representation of the log message (`ILogObj`).
> **`tslog` follows a semantic release policy.** A major version change indicates breaking changes.<br><br>
556
+
> `tslog >=4` is less limiting when it comes to configuration. There are many use cases (especially when it comes to integration with 3rd party services) that now can be achieved elegantly and were not possible before.
557
+
558
+
### Name and other constructor parameters
559
+
560
+
`tslog` < 4 had a name parameter on the constructor. v4 removed all preconfigured parameters and allows you to create your own log object (s. "Defining and accessing `logObj`").
### Tip: RequestID: Mark a request (e.g. HTTP) call with AsyncLocalStorage and `tslog`
573
+
### RequestID: Mark a request (e.g. HTTP) call with AsyncLocalStorage and `tslog`
552
574
>**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>
553
575
554
576
**❗ Keep track of all subsequent calls and promises originated from a single request (e.g. HTTP).**
0 commit comments