@zcatalyst/utils
Version:
55 lines (54 loc) • 1.7 kB
TypeScript
interface ICatalystLoggerOptions {
enable_info: boolean;
enable_warn: boolean;
enable_error: boolean;
enable_debug: boolean;
enable_fine: boolean;
}
/**
* The `ZCLogger` supports the following log levels based on the precedence, as the level with the highest values will have the most precedence.
* i.e. the log level acts as a minimum threshold and allows the logs with levels equal to or higher to be logged.
*
* For Example, if we set the log level to WARN(4) the levels WARN(4) and ERROR(5) will be logged as they are equal to or higher than the
* threshold set by log level which is WARN(4). Whereas the logs INFO(3), DEBUG(2) and FINE(1) won't be logged as their level is lesser than the
* set threshold
*
* ```md
* | Level | Precedence |
* |-------|------------|
* | NONE | INF |
* | ALL | 0 |
* | FINE | 1 |
* | DEBUG | 2 |
* | INFO | 3 |
* | WARN | 4 |
* | ERROR | 5 |
* ```
*/
export declare enum LEVEL {
NONE = "none",
ALL = "all",
FINE = "fine",
DEBUG = "debug",
INFO = "info",
WARN = "warn",
ERROR = "error"
}
declare class Logger {
#private;
logOptions: ICatalystLoggerOptions;
constructor(options?: ICatalystLoggerOptions);
info(message: string): void;
warn(message: string): void;
error(message: string): void;
debug(message: string): void;
fine(message: string): void;
/**
* Set the log level for the logger.
* @param level the log level to set. Defaults to {@link LEVEL.NONE}
* @returns Logger instance
*/
setLogLevel(level?: LEVEL): Logger;
}
export declare const LOGGER: Logger;
export {};