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: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@
30
30
👨👧👦 **Sub logger with inheritance**<br>
31
31
🙊 **Mask/hide secrets and keys**<br>
32
32
📦 **ESM with tree shaking support**<br>
33
-
✍️ **well documented and tested**<br>
33
+
✍️ **Well documented and tested**<br>
34
34
35
35
## Example
36
36
@@ -132,8 +132,8 @@ logger.fatal(new Error("I am a pretty Error with a stacktrace."));
132
132
-**Native source maps lookup:** Shows exact position also in TypeScript code (compile-to-JS), one click to IDE position
133
133
-**Pretty Error:** Errors and stack traces printed in a structured way and fully accessible through _JSON_ (e.g. external Log services)
134
134
-**ES Modules:** import syntax with ([tree-shaking](https://webpack.js.org/guides/tree-shaking/))
135
-
-**Object/JSON highlighting:** Nicely prints out an objects
136
-
-**Sub Logger with inheritance:** Powerful subloggers with settings inheritance, also at runtime
135
+
-**Object/JSON highlighting:** Nicely prints out objects
136
+
-**Sub Logger with inheritance:** Powerful sub-loggers with settings inheritance, also at runtime
137
137
-**Secrets masking:** Prevent passwords and secrets from sneaking into log files by masking them
138
138
-**Short paths:** Paths are relative to the root of the application folder
139
139
-**Prefixes:** Prefix log messages and bequeath prefixes to child loggers
@@ -142,13 +142,13 @@ logger.fatal(new Error("I am a pretty Error with a stacktrace."));
142
142
143
143
### <aname="life_cycle"></a>Lifecycle of a log message
144
144
145
-
Every incoming log message runs through a number of steps before being displayed or handed over to a "transport". Every steps can be overwritten and adjusted.
145
+
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.
146
146
147
147

148
148
149
149
-**log message** Log message comes in through the `BaseLogger.log()` method
150
150
-**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.) Are there more than one, they will be pu 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.
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.
152
152
-**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
153
-**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
154
-**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.
@@ -178,7 +178,7 @@ In addition to the default log level, custom log level can be defined in the sam
178
178
`log` method expects the following parameters:
179
179
- logLevelId - Log level ID e.g. 0
180
180
- logLevelName - Log level name e.g. silly
181
-
- args - Multiple log attributes that should be logged out.
181
+
- args - Multiple log attributes that should be logged.
182
182
183
183
> **Tip:** Also the generic logging method (log()) returns a _JSON_ representation of the log message (`ILogObject`).
184
184
@@ -192,7 +192,7 @@ export class CustomLogger<LogObj> extends BaseLogger<LogObj> {
192
192
193
193
/**
194
194
* Logs a _CUSTOM_ message.
195
-
* @paramargs - Multiple log attributes that should be logged out.
195
+
* @paramargs - Multiple log attributes that should be logged.
196
196
*/
197
197
public custom(...args:unknown[]):LogObj&ILogObjMeta {
198
198
returnsuper.log(8, "CUSTOM", ...args);
@@ -202,7 +202,7 @@ export class CustomLogger<LogObj> extends BaseLogger<LogObj> {
202
202
```
203
203
204
204
### Settings
205
-
`tslog` is highly customizable and pretty much every aspect can bei either configured or overwritten.
205
+
`tslog` is highly customizable and pretty much every aspect can be either configured or overwritten.
206
206
A `settings` object is the first parameter passed to the `tslog` constructor:
207
207
208
208
```typescript
@@ -270,7 +270,7 @@ Enables you to overwrite the looks of a formatted _"pretty"_ log message by prov
270
270
Following settings are available for styling:
271
271
272
272
-**Templates:**
273
-
-`prettyLogTemplate`: template string for logs message. Possible placeholder:
273
+
-`prettyLogTemplate`: template string for log messages. Possible placeholders:
274
274
-`{{yyyy}}`: year
275
275
-`{{mm}}`: month
276
276
-`{{dd}}`: day
@@ -282,13 +282,13 @@ Following settings are available for styling:
282
282
-`{{logLevelName}}`: name of the log level
283
283
-`{{fullFilePath}}`: a full path starting from `/` root
284
284
-`{{filePathWithLine}}`: a full path below the project path with line number
285
-
-`prettyErrorTemplate`: template string for error message. Possible placeholder:
285
+
-`prettyErrorTemplate`: template string for error message. Possible placeholders:
286
286
-`{{errorName}}`: name of the error
287
287
-`{{errorMessage}}`: error message
288
288
-`{{errorStack}}`: Placeholder for all stack lines defined by `prettyErrorStackTemplate`
289
-
-`prettyErrorStackTemplate`: template string for error stack trace lines. Possible placeholder:
289
+
-`prettyErrorStackTemplate`: template string for error stack trace lines. Possible placeholders:
290
290
-`{{fileName}}`: name of the file
291
-
-`{{filePathWithLine}}`: a full path below the project path with line number
291
+
-`{{filePathWithLine}}`: a full path below the project path with a line number
292
292
-`{{method}}`: _optional_ name of the invoking method
@@ -302,7 +302,7 @@ Following settings are available for styling:
302
302
303
303
#### Log meta information
304
304
`tslog` collects meta information for every log, like runtime, code position etc. The meta information collected depends on the runtime (browser or Node.js) and is accessible through the `LogObj`.
305
-
You can define the property containing this meta information with `metaProperty`, which is "_meta" per default.
305
+
You can define the property containing this meta information with `metaProperty`, which is "_meta" by default.
306
306
307
307
#### Pretty templates and styles (color settings)
308
308
@@ -340,7 +340,7 @@ There are multiple ways of masking secrets, before they get exposed:
340
340
341
341
-`maskPlaceholder`: Placeholder to replaced masked secrets with, Default: `[***]`
342
342
-`maskValuesOfKeys`: Array of keys to replace the values with the placeholder (`maskPlaceholder`). Default: `["password"]`
343
-
-`maskValuesOfKeysCaseInsensitive`: Should the keys be matched caseinsensitive (e.g. "password" would replace "password" as well as "Password", and "PASSWORD"). Default: `false`
343
+
-`maskValuesOfKeysCaseInsensitive`: Should the keys be matched case-insensitive (e.g. "password" would replace "password" as well as "Password", and "PASSWORD"). Default: `false`
344
344
-`maskValuesRegEx`: For even more flexibility, you can also replace strings and object values with a RegEx.
Copy file name to clipboardExpand all lines: docs/README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@
30
30
👨👧👦 **Sub logger with inheritance**<br>
31
31
🙊 **Mask/hide secrets and keys**<br>
32
32
📦 **ESM with tree shaking support**<br>
33
-
✍️ **well documented and tested**<br>
33
+
✍️ **Well documented and tested**<br>
34
34
35
35
## Example
36
36
@@ -132,8 +132,8 @@ logger.fatal(new Error("I am a pretty Error with a stacktrace."));
132
132
-**Native source maps lookup:** Shows exact position also in TypeScript code (compile-to-JS), one click to IDE position
133
133
-**Pretty Error:** Errors and stack traces printed in a structured way and fully accessible through _JSON_ (e.g. external Log services)
134
134
-**ES Modules:** import syntax with ([tree-shaking](https://webpack.js.org/guides/tree-shaking/))
135
-
-**Object/JSON highlighting:** Nicely prints out an objects
136
-
-**Sub Logger with inheritance:** Powerful subloggers with settings inheritance, also at runtime
135
+
-**Object/JSON highlighting:** Nicely prints out objects
136
+
-**Sub Logger with inheritance:** Powerful sub-loggers with settings inheritance, also at runtime
137
137
-**Secrets masking:** Prevent passwords and secrets from sneaking into log files by masking them
138
138
-**Short paths:** Paths are relative to the root of the application folder
139
139
-**Prefixes:** Prefix log messages and bequeath prefixes to child loggers
@@ -142,13 +142,13 @@ logger.fatal(new Error("I am a pretty Error with a stacktrace."));
142
142
143
143
### <aname="life_cycle"></a>Lifecycle of a log message
144
144
145
-
Every incoming log message runs through a number of steps before being displayed or handed over to a "transport". Every steps can be overwritten and adjusted.
145
+
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.
146
146
147
147

148
148
149
149
-**log message** Log message comes in through the `BaseLogger.log()` method
150
150
-**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.) Are there more than one, they will be pu 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.
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.
152
152
-**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
153
-**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
154
-**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.
@@ -178,7 +178,7 @@ In addition to the default log level, custom log level can be defined in the sam
178
178
`log` method expects the following parameters:
179
179
- logLevelId - Log level ID e.g. 0
180
180
- logLevelName - Log level name e.g. silly
181
-
- args - Multiple log attributes that should be logged out.
181
+
- args - Multiple log attributes that should be logged.
182
182
183
183
> **Tip:** Also the generic logging method (log()) returns a _JSON_ representation of the log message (`ILogObject`).
184
184
@@ -192,7 +192,7 @@ export class CustomLogger<LogObj> extends BaseLogger<LogObj> {
192
192
193
193
/**
194
194
* Logs a _CUSTOM_ message.
195
-
* @paramargs - Multiple log attributes that should be logged out.
195
+
* @paramargs - Multiple log attributes that should be logged.
196
196
*/
197
197
public custom(...args:unknown[]):LogObj&ILogObjMeta {
198
198
returnsuper.log(8, "CUSTOM", ...args);
@@ -202,7 +202,7 @@ export class CustomLogger<LogObj> extends BaseLogger<LogObj> {
202
202
```
203
203
204
204
### Settings
205
-
`tslog` is highly customizable and pretty much every aspect can bei either configured or overwritten.
205
+
`tslog` is highly customizable and pretty much every aspect can be either configured or overwritten.
206
206
A `settings` object is the first parameter passed to the `tslog` constructor:
207
207
208
208
```typescript
@@ -270,7 +270,7 @@ Enables you to overwrite the looks of a formatted _"pretty"_ log message by prov
270
270
Following settings are available for styling:
271
271
272
272
-**Templates:**
273
-
-`prettyLogTemplate`: template string for logs message. Possible placeholder:
273
+
-`prettyLogTemplate`: template string for log messages. Possible placeholders:
274
274
-`{{yyyy}}`: year
275
275
-`{{mm}}`: month
276
276
-`{{dd}}`: day
@@ -282,13 +282,13 @@ Following settings are available for styling:
282
282
-`{{logLevelName}}`: name of the log level
283
283
-`{{fullFilePath}}`: a full path starting from `/` root
284
284
-`{{filePathWithLine}}`: a full path below the project path with line number
285
-
-`prettyErrorTemplate`: template string for error message. Possible placeholder:
285
+
-`prettyErrorTemplate`: template string for error message. Possible placeholders:
286
286
-`{{errorName}}`: name of the error
287
287
-`{{errorMessage}}`: error message
288
288
-`{{errorStack}}`: Placeholder for all stack lines defined by `prettyErrorStackTemplate`
289
-
-`prettyErrorStackTemplate`: template string for error stack trace lines. Possible placeholder:
289
+
-`prettyErrorStackTemplate`: template string for error stack trace lines. Possible placeholders:
290
290
-`{{fileName}}`: name of the file
291
-
-`{{filePathWithLine}}`: a full path below the project path with line number
291
+
-`{{filePathWithLine}}`: a full path below the project path with a line number
292
292
-`{{method}}`: _optional_ name of the invoking method
@@ -302,7 +302,7 @@ Following settings are available for styling:
302
302
303
303
#### Log meta information
304
304
`tslog` collects meta information for every log, like runtime, code position etc. The meta information collected depends on the runtime (browser or Node.js) and is accessible through the `LogObj`.
305
-
You can define the property containing this meta information with `metaProperty`, which is "_meta" per default.
305
+
You can define the property containing this meta information with `metaProperty`, which is "_meta" by default.
306
306
307
307
#### Pretty templates and styles (color settings)
308
308
@@ -340,7 +340,7 @@ There are multiple ways of masking secrets, before they get exposed:
340
340
341
341
-`maskPlaceholder`: Placeholder to replaced masked secrets with, Default: `[***]`
342
342
-`maskValuesOfKeys`: Array of keys to replace the values with the placeholder (`maskPlaceholder`). Default: `["password"]`
343
-
-`maskValuesOfKeysCaseInsensitive`: Should the keys be matched caseinsensitive (e.g. "password" would replace "password" as well as "Password", and "PASSWORD"). Default: `false`
343
+
-`maskValuesOfKeysCaseInsensitive`: Should the keys be matched case-insensitive (e.g. "password" would replace "password" as well as "Password", and "PASSWORD"). Default: `false`
344
344
-`maskValuesRegEx`: For even more flexibility, you can also replace strings and object values with a RegEx.
0 commit comments