ng2-logger
Version:
isomorphic logger for browser/server in typescript
63 lines (62 loc) • 2.04 kB
TypeScript
export declare enum Level {
DATA = 0,
INFO = 1,
WARN = 2,
ERROR = 3,
SUCCESS = 4,
TASK_STARTED = 5,
TASK_DONE = 6
}
export declare const LevelKey: {
0: string;
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
};
export declare const LevelOrder: string[];
export declare namespace Log {
export const settings: {
mutedModules: string[];
showTimestamp: boolean;
};
export const create: (moduleName: string, ...level: Level[]) => Logger;
export const setGlobalLevel: (level: Level) => void;
export const onlyLevel: (...levels: Level[]) => void;
export const onlyModules: (...modules: (string | RegExp)[]) => void;
export const disableAllLogsPermanetly: () => void;
export const disableAllLogs: () => void;
export const enableAllLogs: () => void;
class Logger {
readonly moduleName: string;
color: string;
allowed: Level[];
isMuted: boolean;
/**
* Set how much characters in terminal/console
* your module name should take
*/
moduleWidth: number | undefined;
constructor(moduleName: string, color: string, allowed: Level[], isMuted: boolean,
/**
* Set how much characters in terminal/console
* your module name should take
*/
moduleWidth: number | undefined);
data: (message: string, ...data: any[]) => void;
d: (message: string, ...data: any[]) => void;
info: (message: string, ...data: any[]) => void;
i: (message: string, ...data: any[]) => void;
warn: (message: string, ...data: any[]) => void;
w: (message: string, ...data: any[]) => void;
error: (message: string, ...data: any[]) => void;
er: (message: string, ...data: any[]) => void;
setLevel(l: Level): this;
mute(): this;
logOnlyWhen(expression: (() => boolean) | boolean): void;
private createLevelMethod;
}
export {};
}