UNPKG

@elsikora/cladi

Version:

ClaDI is a library for creating and managing classes in TypeScript.

73 lines 2.67 kB
import type { ILogger, ILoggerMethodOptions } from '../../domain/interface/index'; import type { IConsoleLoggerOptions } from '../interface/index'; /** * Console logger implementation. * @see {@link https://elsikora.com/docs/cladi/services/logging} */ export declare class ConsoleLoggerService implements ILogger { /** * Current log level. Messages below this level will not be logged. */ private readonly LEVEL; /** * Default source identifier. */ private readonly SOURCE?; /** * Create a new console logger. * @param {IConsoleLoggerOptions} [options] - The options to use for the logger. * @default */ constructor(options?: IConsoleLoggerOptions); /** * Log a debug message. * @param {string} message Message to log. * @param {ILoggerMethodOptions} [options] Optional logging options. */ debug(message: string, options?: ILoggerMethodOptions): void; /** * Log an error message. * @param {string} message Message to log. * @param {ILoggerMethodOptions} [options] Optional logging options. */ error(message: string, options?: ILoggerMethodOptions): void; /** * Log an info message. * @param {string} message Message to log. * @param {ILoggerMethodOptions} [options] Optional logging options. */ info(message: string, options?: ILoggerMethodOptions): void; /** * Log a trace message. * @param {string} message Message to log. * @param {ILoggerMethodOptions} [options] Optional logging options. */ trace(message: string, options?: ILoggerMethodOptions): void; /** * Log a warning message. * @param {string} message Message to log. * @param {ILoggerMethodOptions} [options] Optional logging options. */ warn(message: string, options?: ILoggerMethodOptions): void; /** * Combines source from options with class source. * @param {string} [optionsSource] Source from options. * @returns {string|undefined} Combined source or undefined if both sources are undefined. */ private combineSource; /** * Format a message for logging. * @param {ELoggerLogLevel} level Log level. * @param {string} message Message to log. * @param {ILoggerMethodOptions} [options] Optional logging options. * @returns {string} Formatted message. */ private formatMessage; /** * Check if the given level should be logged. * @param {ELoggerLogLevel} level Level to check. * @returns {boolean} True if the level should be logged. */ private shouldLog; } //# sourceMappingURL=console-logger.service.d.ts.map