nestjs-logitron
Version:
Powerful logger module for Nodejs/ Nestjs, seamlessly integrating Pino and Winston for flexible logging with easy configuration.
54 lines (51 loc) • 1.63 kB
text/typescript
import { LoggerOptions, DestinationStream } from 'pino';
import { LoggerOptions as LoggerOptions$1 } from 'winston';
interface ILogger {
info(message: string, ...optionalParams: any[]): void;
warn(message: string, ...optionalParams: any[]): void;
error(message: string, ...optionalParams: any[]): void;
debug(message: string, ...optionalParams: any[]): void;
infoWithExecutionTime(message: string, execution: {
name: string;
start: number;
}, ...optionalParams: any[]): void;
warnWithExecutionTime(message: string, execution: {
name: string;
start: number;
}, ...optionalParams: any[]): void;
errorWithExecutionTime(message: string, execution: {
name: string;
start: number;
}, ...optionalParams: any[]): void;
debugWithExecutionTime(message: string, execution: {
name: string;
start: number;
}, ...optionalParams: any[]): void;
}
type LogLevel = keyof ILogger;
declare enum LoggerType {
WINSTON = "winston",
PINO = "pino"
}
type IExtraOptions = {
appName?: string;
};
type IPinoOptions = {
type?: LoggerType.PINO;
options?: (LoggerOptions | DestinationStream) & IExtraOptions;
};
type IWinstonOptions = {
type?: LoggerType.WINSTON;
options?: LoggerOptions$1 & IExtraOptions;
};
type ILoggerOptions = IPinoOptions | IWinstonOptions;
interface LogEntry {
id: string;
timestamp: string;
level: string;
appName: string;
message: string;
payload: string;
execution: string;
}
export { type ILogger, type ILoggerOptions, type LogEntry, type LogLevel, LoggerType };