@pulzar/core
Version:
Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support
50 lines • 2.02 kB
TypeScript
import pino from "pino";
export interface LogContext {
requestId?: string;
userId?: string;
traceId?: string;
spanId?: string;
[key: string]: any;
}
export interface PinoLoggerOptions {
level?: pino.LevelWithSilent;
name?: string;
transport?: pino.TransportTargetOptions | pino.TransportTargetOptions[];
formatters?: {
level?: (label: string, number: number) => object;
log?: (object: object) => object;
};
timestamp?: (() => string) | boolean;
base?: object | null;
serializers?: Record<string, pino.SerializerFn>;
redact?: string[] | any;
hooks?: any;
}
export declare const logger: import("pino").Logger<never>;
export declare function setRequestContext(context: LogContext): void;
export declare function getRequestContext(): LogContext | undefined;
export declare function withRequestContext<T>(context: LogContext, fn: () => T): T;
export declare function createChildLogger(bindings: Record<string, any>, options?: PinoLoggerOptions): pino.Logger;
export declare function createRequestLogger(requestId: string, userId?: string): pino.Logger;
export declare function logPerformance(operation: string, startTime: number, metadata?: Record<string, any>): void;
export declare function logError(error: Error, context?: Record<string, any>, message?: string): void;
export declare const log: {
trace: (obj: any, msg?: string) => void;
debug: (obj: any, msg?: string) => void;
info: (obj: any, msg?: string) => void;
warn: (obj: any, msg?: string) => void;
error: (obj: any, msg?: string) => void;
fatal: (obj: any, msg?: string) => void;
message: {
trace: (msg: string) => void;
debug: (msg: string) => void;
info: (msg: string) => void;
warn: (msg: string) => void;
error: (msg: string) => void;
fatal: (msg: string) => void;
};
};
export declare function flushLogger(): Promise<void>;
export { pino };
export default logger;
//# sourceMappingURL=logger.d.ts.map