Optional
loggerYou can pass a custom name, eg "My LogZen".
It can be a "path" where it resides, physically or conceptually
eg /controllers/customer.controller
Note that the physical (relative) path is automatically printed on the Header, if loggerName is not present.
It's best to leave this undefined and use PathReplacements
@default: undefined, in which case the Header prints the resolved filename where LogZen is created in.
Optional
outputWhere & how to print / output log messages and info.
Optional
headerCustomize Header options, or disable with header: false
Possible values:
true: prints a default header
Header object: Header enabled with separate settings within.
false: Header is disabled
Example:
Issuing a l.warn('Hello World')
will output something like:
```
WARN (src/examples-docs/logzen-examples-docs-tests-playground): Hello World
```
With header: false, it just prints
```
Hello World"
```
@default: header object with defaults
Optional
stackIf using LogZen wrapped (eg subclass, proxy etc) inside another MyLogger, it will resolve to wrong filepath, e.g. the wrapped MyLogger as the path it as created.
Adjust accordingly ;-)
Optional
stackIf using LogZen wrapped (eg Proxied) inside another MyLogger,
it will report itself (i.e the wrapped MyLogger) as the path
it was called to l.log()
from (eg via options.header.resolvedFromCall
).
Adjust accordingly ;-)
Optional
logThe logLevel
to allow, i.e what logging severity is in effect.
See logLevel
@default: undefined, but debug
is implicitly enforced (hard coded)
Optional
tableConfigure the logLevel
of the table() method.
@default: ELogLevel.LOG
Optional
debugThe debugLevel
is the debug-only severity to allow.
It's an arbitrary number of a range of your choosing, but 0-100 is recommended.
Optional
traceThe traceLevel
is the .trace()
-only granular severity to allow.
It's an arbitrary number of a range of your choosing, but 0-100 is recommended.
Optional
colorsWhether to use colors in the whole output.
It also turns off stringColors.
If inspect.colors
is missing in an atomic options set or update, it inherits this one (if present).
@default: true
Optional
stringWhether to use the LogLevel color on (top level) strings
@default: true
Optional
traceThe TraceOptions to use
Optional
inspectThe LogZenInspectOptions to use
If false, it disables inspect completely, and uses print
Optional
printThe PrintOptions to use, if inspect is false
Optional
printOptional
rawWhether to pass the raw values of the argsToLog, without any formatting (inspect, colors, console interpolation etc).
Disables all relevant options (colors, inspect & console style interpolation).
Useful for JSON output.
@default: undefined, i.e false
Optional
kidsAdd & maintain a list of kids loggers, using these Options.
These kid loggers are fully managed by LogZen, updating them via options and not programmatically.
Kids rules are:
When path options merge, kids loggers Options from nested paths (eg /my/app/nested/path
) are added to those in above paths (eg /my/app
), not replacing those above (as it happens with other options).
Null is a special value: if {kids: null} or {kids: [null, {loggerName: 'a kid'}]}, are not inheriting those before the null, up in the chain to root.
Kids can't have their own kids (i.e no nested kids / grandkids). This because it's not tested and could lead to unexpected results. It will throw an Error if trying to do so.
When kids's options change, the kids are recreated with these new options (i.e no partial options merging with kids options)
The LogZen Options interface
Note: it is a class only for validation purposes via class-validator, but it's not meant to be instantiated.
See
Cascading Options