/** * The possible log levels. * LogLevel.Off is never emitted and only used with Logger.level property to disable logs. */ export declare enum LogLevel { Off = 0, Error = 1, Warning = 2, Info = 3, Debug = 4, Trace = 5 } /** * Log output handler function. */ export declare type LogOutput = (source: string | undefined, level: LogLevel, ...objects: any[]) => void; /** * Simple logger system with the possibility of registering custom outputs. * * 4 different log levels are provided, with corresponding methods: * - trace : for trace information (will appear on console as debug) * - debug : for debug information * - info : for informative status of the application (success, ...) * - warning : for non-critical errors that do not prevent normal application behavior * - error : for critical errors that prevent normal application behavior * * Example usage: * ``` * import { Logger } from '@core'; * * const log = new Logger('MyComponent'); * ... * log.debug('something happened'); * ``` * * To disable debug and info logs in production, add this snippet to your root component: * ``` * export class AppComponent implements OnInit { * ngOnInit() { * if (environment.production) { * Logger.enableProductionMode(); * } * ... * } * } * */ export declare class LogManager { private source?; /** * LogManager cache to reuse same-tag instances. */ private static loggers; /** * Current logging level. * Set it to LogLevel.Off to disable logs completely. */ private static level; constructor(source?: string); /** * Logs messages or objects with the trace level. */ trace(...objects: any[]): void; /** * Logs messages or objects with the debug level. * Works the same as console.log(). */ debug(...objects: any[]): void; /** * Logs messages or objects with the info level. * Works the same as console.log(). */ info(...objects: any[]): void; /** * Logs messages or objects with the warning level. * Works the same as console.log(). */ warn(...objects: any[]): void; /** * Logs messages or objects with the error level. * Works the same as console.log(). */ error(...objects: any[]): void; private log; /** * Enables production mode. * Sets logging level to LogLevel.Warning. */ static enableProductionMode(): void; static tag(source: string): LogManager; } /** * Default LogManager with no tag specified. */ export declare const Logger: LogManager;