jsout
Version:
A Syslog-compatible, small, and simple logger for Typescript/Javascript projects. Sponsored by https://aeroview.io
44 lines (43 loc) • 1.6 kB
TypeScript
export type CliOptions = {
level: LogLevel;
format: LogFormat;
};
export declare enum LogLevel {
emerg = 0,// System is unusable. (Not for application use)
alert = 1,// Action must be taken immediately (Not for application use)
fatal = 2,// The service is going to stop or become unusable. Unrecoverable error. Immediate attention required.
critical = 2,
error = 3,// Error condition. Requires attention.
warn = 4,// Possible issue that could root cause a bug. Attention advised. If not an issue, demote to info/debug.
notice = 5,// Normal but significant condition. No action required.
info = 6,// Detail on regular operation.
debug = 7
}
export type SerializedError = {
name: string;
message: string;
stack: string[];
cause?: SerializedError;
[key: string]: any;
};
/**
* Set with process.env.LOG_FORMAT
*/
export declare enum LogFormat {
json = "json",
cli = "cli",
human = "cli"
}
export declare const logger: {
emerg: (message?: string, error?: any, data?: any) => void;
alert: (message?: string, error?: any, data?: any) => void;
critical: (message?: string, error?: any, data?: any) => void;
fatal: (message?: string, error?: any, data?: any) => void;
error: (message?: string, error?: any, data?: any) => void;
warn: (message?: string, error?: any, data?: any) => void;
notice: (message?: string, data?: any) => void;
info: (message?: string, data?: any) => void;
debug: (message?: string, data?: any) => void;
};
export * from './log';
export * from './mockLoggerFactory';