jet-logger
Version:
A super quick, easy to setup logging tool for NodeJS/TypeScript.
63 lines (62 loc) • 2.19 kB
TypeScript
/******************************************************************************
Constants
******************************************************************************/
declare const LOGGER_MODES: {
readonly Console: "CONSOLE";
readonly File: "FILE";
readonly Custom: "CUSTOM";
readonly Off: "OFF";
};
declare const FORMATS: {
readonly Line: "LINE";
readonly Json: "JSON";
};
export declare const JetLogger: {
readonly Modes: {
readonly Console: "CONSOLE";
readonly File: "FILE";
readonly Custom: "CUSTOM";
readonly Off: "OFF";
};
readonly Formats: {
readonly Line: "LINE";
readonly Json: "JSON";
};
};
/******************************************************************************
Types
******************************************************************************/
type LoggerModes = (typeof LOGGER_MODES)[keyof typeof LOGGER_MODES];
type Formats = (typeof FORMATS)[keyof typeof FORMATS];
type LogFunction = (content: unknown, printFull?: boolean) => void;
export type CustomLogger = (timestamp: Date, prefix: string, content: unknown) => void;
interface Options {
mode?: LoggerModes;
filepath?: string;
filepathDatetimeParam?: boolean;
timestamp?: boolean;
format?: Formats;
customLogger?: CustomLogger;
}
/******************************************************************************
Functions
******************************************************************************/
/**
* Default function
*/
export declare function jetLogger(options?: Options): {
readonly info: LogFunction;
readonly imp: LogFunction;
readonly warn: LogFunction;
readonly err: LogFunction;
};
/******************************************************************************
Export
******************************************************************************/
declare const _default: {
readonly info: LogFunction;
readonly imp: LogFunction;
readonly warn: LogFunction;
readonly err: LogFunction;
};
export default _default;