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
+26-24
Original file line number
Diff line number
Diff line change
@@ -95,31 +95,33 @@ class Rectangle {
95
95
96
96
### Configuration
97
97
98
-
Config must be a JavaScript ```Object``` with the following attributes:
99
-
***logger** - logger, which build decorator will use, *[console](https://nodejs.org/api/console.html)* by default, see [logger](#logger) for more details
100
-
***name** - the app name, to include in all logs, could be omitted.
101
-
102
-
Next values could also be passed to constructor config, but are customizable from ```decorator(customConfig)``` invokation:
103
-
***timestamp** - if set to *true* timestamps will be added to all logs.
104
-
***level** - default log-level, pay attention that logger must support it as ```logger.level(smth)```, *'info'* by default. Also *function* could be passed. The function will receive logged data and should return log-level as *string*.
105
-
***errorLevel** - level, used for errors. *'error'* by default. Also *function* could be passed. The function will receive logged data and should return log-level as *string*.
106
-
***errorsOnly** - if set to *true* logger will catch only errors.
98
+
Config must be a JavaScript `Object` with the following attributes:
99
+
***logger** - the logger that the build decorator will use. *[console](https://nodejs.org/api/console.html)* by default; see [logger](#logger) for more details.
100
+
***name** - the app name to include in all logs; it could be omitted.
101
+
102
+
Next values could also be passed to the constructor config, but are customizable from the `decorator(customConfig)` invocation:
103
+
***timestamp** - if set to *true*, timestamps will be added to all logs.
104
+
***level** - the default log-level; pay attention that the logger must support it as `logger.level(smth)`, *'info'* by default. Also, a *function* could be passed. The function will receive logged data and should return the log-level as a *string*.
105
+
***errorLevel** - the level used for errors; *'error'* by default. Also, a *function* could be passed. The function will receive logged data and should return the log-level as a *string*.
106
+
***paramsLevel** - the level used for logging params. Logger will print input params before the function starts executing. Also, a *function* could be passed. The function will receive logged data and should return the log-level as a *string*. If omitted, nothing will be logged before execution.
107
+
***errorsOnly** - if set to *true*, the logger will catch only errors.
107
108
***logErrors**: next options available:
108
-
-`deepest`: log only the deepest occurrence of the error. This option prevents 'error spam'
109
-
***paramsSanitizer** - function to sanitize input parametrs from sensitive or redundant data, see [sanitizers](#sanitizers) for more details, by default [dataSanitizer](#sanitizers).
110
-
***resultSanitizer** - output data sanitizer, by default [dataSanitizer](#sanitizers)
111
-
***errorSanitizer** - error sanitizer, by default [simpleSanitizer](#sanitizers)
112
-
***contextSanitizer** - function context sanitizer, if ommited, no context will be logged.
113
-
***dublicates** - if set to *true*, it is possible to use multiple decorators at once (see [example](#duplicates)). **Note:**`duplicates` key also works, `dublicates` will be completle renamed to `duplicates` in version 2.0.
114
-
***keepReflectMetadata** - if `logger-decorator` is used with other decorators, they can set own [reflect metadata](https://blog.bitsrc.io/typescripts-reflect-metadata-what-it-is-and-how-to-use-it-fb7b19cfc7e2). by passing `keepReflectMetadata` array, you can prevent metadata from reset. For example for nestJS its good idea to use `{ keepReflectMetadata: ['method', 'path'] }`.
115
-
116
-
Next parametrs could help in class method filtering:
117
-
***getters** - if set to *true*, [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) will also be logged (applied to class and class-method decorators)
118
-
***setters** - if set to *true*, [setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) will also be logged (applied to class and class-method decorators)
119
-
***classProperties** - if set to *true*, [class-properties](https://babeljs.io/docs/en/babel-plugin-proposal-class-properties) will also be logged (applied to class decorators only)
120
-
***include** - array with method names, for which logs will be added.
121
-
***exclude** - array with method names, for which logs won't be added.
122
-
***methodNameFilter** - function, to filter method names
109
+
-`deepest`: log only the deepest occurrence of the error. This option prevents 'error spam.'
110
+
***paramsSanitizer** - function to sanitize input parameters from sensitive or redundant data; see [sanitizers](#sanitizers) for more details, by default [dataSanitizer](#sanitizers).
111
+
***resultSanitizer** - output data sanitizer, by default [dataSanitizer](#sanitizers).
112
+
***errorSanitizer** - error sanitizer, by default [simpleSanitizer](#sanitizers).
113
+
***contextSanitizer** - function context sanitizer; if omitted, no context will be logged.
114
+
***duplicates** - if set to *true*, it is possible to use multiple decorators at once (see [example](#duplicates)).
115
+
***keepReflectMetadata** - if `logger-decorator` is used with other decorators, they can set own [reflect metadata](https://blog.bitsrc.io/typescripts-reflect-metadata-what-it-is-and-how-to-use-it-fb7b19cfc7e2). By passing `keepReflectMetadata` array, you can prevent metadata from resetting. For example, for NestJS, it's a good idea to use `{ keepReflectMetadata: ['method', 'path'] }`.
116
+
117
+
Next parameters could help in class method filtering:
118
+
***getters** - if set to *true*, [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) will also be logged (applied to class and class-method decorators).
119
+
***setters** - if set to *true*, [setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) will also be logged (applied to class and class-method decorators).
120
+
***classProperties** - if set to *true*, [class-properties](https://babeljs.io/docs/en/babel-plugin-proposal-class-properties) will also be logged (applied to class decorators only).
121
+
***include** - array with method names for which logs will be added.
122
+
***exclude** - array with method names for which logs won't be added.
123
+
***methodNameFilter** - function to filter method names.
0 commit comments