@kephas/core
Version:
Provides a common infrastructure for all the other Kephas Framework components: ambient services, dynamic reflection, composition, application management, and others.
122 lines (121 loc) • 3.67 kB
TypeScript
/**
* Enumerates the logging levels.
*
* @enum {number}
*/
export declare enum LogLevel {
/**
* Fatal errors.
*/
Fatal = 0,
/**
* Common errors.
*/
Error = 1,
/**
* Warning information.
*/
Warning = 2,
/**
* Common information.
*/
Info = 3,
/**
* Debugging information.
*/
Debug = 4,
/**
* Tracing information.
*/
Trace = 5
}
/**
* Base service for logging.
*
* @class Logger
*/
export declare class Logger {
private _logLevel;
/**
* Logs the information at the provided level.
*
* @param {LogLevel | string} level The logging level.
* @param {Error} exception The error that occured (may not be specified).
* @param {string} messageFormat The message format.
* @param {...any[]} args The arguments for the message format.
* @memberof Logger
*/
log(level: LogLevel | string, exception: Error | null | undefined, messageFormat: string, ...args: any[]): void;
/**
* Indicates whether logging at the indicated level is enabled.
* @param {LogLevel | string} level The logging level.
* @return true if enabled, false if not.
*/
isEnabled(level: LogLevel | string): boolean;
/**
* Sets the logging level to the indicated one.
*
* @param {(LogLevel | string)} level The new log level.
* @memberof Logger
*/
setLevel(level: LogLevel | string): void;
/**
* Logs the event at the fatal level.
*
* @param {Error | string} event The event to be logged.
* @param {...any[]} args The arguments for the event.
* @memberof Logger
*/
fatal(event: Error | string, ...args: any[]): void;
/**
* Logs the event at the error level.
*
* @param {Error | string} event The event to be logged.
* @param {...any[]} args The arguments for the event.
* @memberof Logger
*/
error(event: Error | string, ...args: any[]): void;
/**
* Logs the event at the warning level.
*
* @param {Error | string} event The event to be logged.
* @param {...any[]} args The arguments for the event.
* @memberof Logger
*/
warn(event: Error | string, ...args: any[]): void;
/**
* Logs the event at the information level.
*
* @param {Error | string} event The event to be logged.
* @param {...any[]} args The arguments for the event.
* @memberof Logger
*/
info(event: Error | string, ...args: any[]): void;
/**
* Logs the event at the debug level.
*
* @param {Error | string} event The event to be logged.
* @param {...any[]} args The arguments for the event.
* @memberof Logger
*/
debug(event: Error | string, ...args: any[]): void;
/**
* Logs the event at the trace level.
*
* @param {Error | string} event The event to be logged.
* @param {...any[]} args The arguments for the event.
* @memberof Logger
*/
trace(event: Error | string, ...args: any[]): void;
/**
* Overridable method for writing to the log.
*
* @param {LogLevel} level The logging level.
* @param {Error} exception The error that occured (may not be specified).
* @param {string} messageFormat The message format.
* @param {any[]} args The arguments for the message format.
* @memberof Logger
*/
protected write(level: LogLevel, exception: Error | null | undefined, messageFormat: string, args: any[]): void;
private _log;
}