UNPKG

logctx

Version:

A Pino-based logger with context-aware logging using async_hooks

52 lines (51 loc) 1.93 kB
/** * A class that provides a contextual logger. * The logger can be used to log messages with additional context. * @template T - The type of the context. */ export declare class ContextualLogger<T = any> { get log(): { /** * Logs a message at the TRACE level. * @param msg The message to log. * @param meta Optional metadata to include in the log. * @returns The result of the logging operation. */ trace: (msg: string, meta?: any) => void; /** * Logs a message at the FATAL level. * @param msg The message to log. * @param meta Optional metadata to include in the log. * @returns The result of the logging operation. */ fatal: (msg: string, meta?: any) => void; /** * Logs a message at the INFO level. * @param msg The message to log. * @param meta Optional metadata to include in the log. * @returns The result of the logging operation. */ info: (msg: string, meta?: any) => void; /** * Logs a message at the ERROR level. * @param msg The message to log. * @param meta Optional metadata to include in the log. * @returns The result of the logging operation. */ error: (msg: string, meta?: any) => void; /** * Logs a message at the WARN level. * @param msg The message to log. * @param meta Optional metadata to include in the log. * @returns The result of the logging operation. */ warn: (msg: string, meta?: any) => void; /** * Logs a message at the DEBUG level. * @param msg The message to log. * @param meta Optional metadata to include in the log. * @returns The result of the logging operation. */ debug: (msg: string, meta?: any) => void; }; }