import { MessageLogLevel, Success } from '../base'; /** * The level of logging to be used. * @public */ export type ReporterLogLevel = 'all' | 'detail' | 'info' | 'warning' | 'error' | 'silent'; /** * Compares two log levels. * @param message - The first log level. * @param reporter - The second log level. * @returns `true` if the message should be logged, `false` if it should be suppressed. * @public */ export declare function shouldLog(message: MessageLogLevel, reporter: ReporterLogLevel): boolean; /** * Stringifies an arbitrary value for logging. * @param value - The value to stringify. * @returns The stringified value. * @param maxLength - The maximum length of the stringified value. * @public */ export declare function stringifyLogValue(value: unknown, maxLength?: number): string; /** * Generic Result-aware logger interface with multiple levels of logging. * @public */ export interface ILogger { /** * The level of logging to be used. */ readonly logLevel: ReporterLogLevel; /** * Logs a message at the given level. * @param level - The level of the message. * @param message - The message to log. * @param parameters - The parameters to log. * @returns `Success` with the logged message if the level is enabled, or * `Success` with `undefined` if the message is suppressed. */ log(level: MessageLogLevel, message?: unknown, ...parameters: unknown[]): Success; /** * Logs a detail message. * @param message - The message to log. * @param parameters - The parameters to log. * @returns `Success` with the logged message if the level is enabled, or * `Success` with `undefined` if the message is suppressed. */ detail(message?: unknown, ...parameters: unknown[]): Success; /** * Logs an info message. * @param message - The message to log. * @param parameters - The parameters to log. * @returns `Success` with the logged message if the level is enabled, or * `Success` with `undefined` if the message is suppressed. */ info(message?: unknown, ...parameters: unknown[]): Success; /** * Logs a warning message. * @param message - The message to log. * @param parameters - The parameters to log. * @returns `Success` with the logged message if the level is enabled, or * `Success` with `undefined` if the message is suppressed. */ warn(message?: unknown, ...parameters: unknown[]): Success; /** * Logs an error message. * @param message - The message to log. * @param parameters - The parameters to log. * @returns `Success` with the logged message if the level is enabled, or * `Success` with `undefined` if the message is suppressed. */ error(message?: unknown, ...parameters: unknown[]): Success; } /** * Abstract base class which implements {@link Logging.ILogger | ILogger}. * @public */ export declare abstract class LoggerBase implements ILogger { /** * {@inheritDoc Logging.ILogger.logLevel} */ logLevel: ReporterLogLevel; protected constructor(logLevel?: ReporterLogLevel); /** * {@inheritDoc Logging.ILogger.detail} */ detail(message?: unknown, ...parameters: unknown[]): Success; /** * {@inheritDoc Logging.ILogger.info} */ info(message?: unknown, ...parameters: unknown[]): Success; /** * {@inheritDoc Logging.ILogger.warn} */ warn(message?: unknown, ...parameters: unknown[]): Success; /** * {@inheritDoc Logging.ILogger.error} */ error(message?: unknown, ...parameters: unknown[]): Success; /** * {@inheritDoc Logging.ILogger.log} */ log(level: MessageLogLevel, message?: unknown, ...parameters: unknown[]): Success; /** * Formats a message and parameters into a string. * @param message - The message to format. * @param parameters - The parameters to format. * @returns The formatted message. * @public */ protected _format(message?: unknown, ...parameters: unknown[]): string; /** * Inner method called for suppressed log messages. * @public */ protected _suppressLog(__level: MessageLogLevel, __message?: unknown, ...__parameters: unknown[]): Success; /** * Inner method called for logged messages. Should be implemented by derived classes. * @param message - The message to log. * @param level - The {@link MessageLogLevel | level} of the message. * @returns `Success` with the logged message, or `Success` with `undefined` if the message is suppressed. * @public */ protected abstract _log(message: string, level: MessageLogLevel): Success; } /** * An in-memory logger that stores logged and suppressed messages. * @public */ export declare class InMemoryLogger extends LoggerBase { /** * The messages that have been logged. * @internal */ private _logged; /** * The messages that have been suppressed. * @internal */ private _suppressed; /** * Creates a new in-memory logger. * @param logLevel - The level of logging to be used. */ constructor(logLevel?: ReporterLogLevel); /** * The messages that have been logged. */ get logged(): string[]; /** * The messages that have been suppressed. */ get suppressed(): string[]; /** * Clears the logged and suppressed messages. */ clear(): void; /** * {@inheritDoc Logging.LoggerBase._log} * @internal */ protected _log(message: string, __level: MessageLogLevel): Success; /** * {@inheritDoc Logging.LoggerBase._suppressLog} * @param level - The level of the message. * @param message - The message to suppress. * @param parameters - The parameters to suppress. * @returns `Success` with `undefined` if the message is suppressed. * @internal */ protected _suppressLog(level: MessageLogLevel, message?: unknown, ...parameters: unknown[]): Success; } /** * A console logger that outputs messages to the console. * @public */ export declare class ConsoleLogger extends LoggerBase { /** * Creates a new console logger. * @param logLevel - The level of logging to be used. */ constructor(logLevel?: ReporterLogLevel); /** * {@inheritDoc Logging.LoggerBase._log} * @internal */ protected _log(message: string, level: MessageLogLevel): Success; } /** * A no-op {@link Logging.LoggerBase | LoggerBase} that does not log anything. * @public */ export declare class NoOpLogger extends LoggerBase { /** * Creates a new no-op logger. * @param logLevel - The level of logging to be used. */ constructor(logLevel?: ReporterLogLevel); /** * {@inheritDoc Logging.LoggerBase._log} * @internal */ protected _log(message: string, __level: MessageLogLevel): Success; } //# sourceMappingURL=logger.d.ts.map