KuzzleLogger #
The main class that provides logging functionality for Kuzzle.
Constructor #
constructor(config: KuzzleLoggerConfig)Parameters #
config: Configuration object (see KuzzleLoggerConfig)
Properties #
level #
get level(): string
set level(level: string)Get or set the current logging level. Valid levels are:
'fatal''error''warn''info''debug''trace'
pino #
get pino(): LoggerGet the underlying Pino logger instance.
Methods #
Logging Methods #
All logging methods share similar signatures:
method(obj: object, msg?: string, ...args: any[]): void
method(obj: unknown, msg?: string, ...args: any[]): void
method(msg: string, ...args: any[]): voidtrace(): Log at trace leveldebug(): Log at debug levelinfo(): Log at info levelwarn(): Log at warn levelerror(): Log at error levelfatal(): Log at fatal level
Each method can be called in multiple ways:
- With an object and optional message:
logger.info({ user: 'john' }, 'User logged in'); - With just a message:
logger.info('System started'); - With an error object:
logger.error(new Error('Connection failed'));
flush() #
async flush(): Promise<void>Flushes any buffered logs to their destination.
child(namespace: string) #
child(namespace: string): KuzzleLoggerCreates a child logger with the specified namespace. The child logger inherits all settings from its parent and adds the namespace to the merging object.