@waiting/log
Version:
Lightweight logging for browser
31 lines (30 loc) • 891 B
TypeScript
export declare enum LogLevel {
trace = 0,
debug = 1,
log = 2,
info = 3,
warn = 4,
error = 5,
silent = 6
}
export declare type LogLevelType = keyof typeof LogLevel;
export declare type PlainLogMsg = string | number | Error | object;
export declare type LogMsgType = PlainLogMsg | PlainLogMsg[];
export interface Config {
/** maximal log message length in Byte. Default: 1024 Byte */
maxMsgLength: number;
/** Whether store error message in LocalStorage */
persist: boolean;
/**
* TTL (sec) for error in LocalStorage,
* pruned automatically when expiry
* Default: 604800(sec) (equal to 7days)
*/
persistTTL: number;
/**
* runLevel to supressing the logLevel listed in ENUM LogLevel which lower then the runLevel
*/
runLevel: LogLevelType;
/** prefix for LocalStorage */
storagePrefix: string;
}