import type { FormatSettings } from "./format/FormatSettings.js";
/**
 * Log levels are available in ascending order of severity.
 */
export declare enum LogLevel {
    ALL = 0,
    TRACE = 1,
    DEBUG = 2,
    INFO = 3,
    WARN = 4,
    ERROR = 5,
    FATAL = 6,
    OFF = 7
}
/**
 * A custom factory for creating Logger instances.
 */
export type LoggerFactory = (name: string, logManager: LogManager) => Logger;
/**
 * Options supported by {@link Logger}.
 */
export type LogOptions = LogMessageOptions | LogMessageResourceOptions;
/**
 * Options with a generic message supported by {@link Logger}.
 */
export interface LogMessageOptions extends BaseLogOptions {
    /**
     * A string representing the log message. The format is the same as the
     * syntax for {@link utilities/format/string!StringFormatter.format},
     * allowing for positional arguments.
     */
    message: string;
}
/**
 * Options that support a language resource message supported by {@link Logger}.
 */
export interface LogMessageResourceOptions extends BaseLogOptions {
    /**
     * A language key corresponding to the message to log.
     */
    messageResource: string;
    /**
     * Fallback message to use if the message resource lookup fails.
     *
     * A string representing the log message. The format is the same as the
     * syntax for {@link utilities/format/string!StringFormatter.format},
     * allowing for positional arguments.
     */
    message?: string;
}
interface BaseLogOptions extends FormatSettings {
    /**
     * The error related to the log.
     */
    error?: Error;
    /**
     * The locale to use when formatting numbers and dates. If not specified,
     * the current locale is used (see locale module).
     */
    locale?: string;
}
/**
 * Interface for logging messages.
 */
export interface Logger {
    /**
     * The current log level of the logger. This acts as a filter for the
     * logger's output. Only messages with a level equal or higher than this
     * value will be written to the log.
     */
    level: LogLevel;
    /**
     * The unique name of the logger.
     */
    readonly name: string;
    /**
     * Logs a message at the given level.
     *
     * @param level The log level.
     * @param messageOrOptions The message to log or the options.
     * @param args Arguments used for replacement tokens in the message.
     */
    log(level: LogLevel, messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * Logs a message at level TRACE.
     *
     * @param messageOrOptions The message to log or the options.
     * @param args Arguments used for replacement tokens in the message.
     */
    trace(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * Logs a message at level DEBUG.
     *
     * @param messageOrOptions The message to log or the options.
     * @param args Arguments used for replacement tokens in the message.
     */
    debug(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * Logs a message at level INFO.
     *
     * @param messageOrOptions The message to log or the options.
     * @param args Arguments used for replacement tokens in the message.
     */
    info(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * Logs a message at level WARN.
     *
     * @param messageOrOptions The message to log or the options.
     * @param args Arguments used for replacement tokens in the message.
     */
    warn(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * Logs a message at level ERROR.
     *
     * @param messageOrOptions The message to log or the options.
     * @param args Arguments used for replacement tokens in the message.
     */
    error(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * Logs a message at level FATAL.
     *
     * @param messageOrOptions The message to log or the options.
     * @param args Arguments used for replacement tokens in the message.
     */
    fatal(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
}
/**
 * Manages loggers and log settings for an application.
 */
export declare class LogManager {
    /**
     * A custom factory used to create new loggers. By default, the log manager
     * will create instances of {@link ConsoleLogger}.
     */
    factory: LoggerFactory | undefined;
    /**
     * A cache for loggers.
     */
    private readonly _loggers;
    /**
     * Maps logger names or namespaces to the log level for that name.
     */
    private readonly _logLevels;
    /**
     * Gets the logger uniquely identified by name.
     *
     * @param name Name of the logger to be created/returned.
     */
    getLogger(name: string): Logger;
    /**
     * Gets the effective log level for a logger or namespace.
     *
     * @param name The name of the logger or namespace.
     */
    getLogLevel(name: string): LogLevel;
    /**
     * Sets the log level for a logger or namespace.
     *
     * @param name The name to set the log level for. This can be the name of a
     *   specific logger, or a "namespace" (prefix for a logger name), in which
     *   case it applies to all loggers in that namespace. For example, if you
     *   set the log level for "gcx.api" to WARN, then only warnings or higher
     *   will be logged for any logger whose name begins with "gcx.api". You can
     *   specify the special name "root" which applies to all loggers.
     * @param logLevel The log level.
     */
    setLogLevel(name: string, logLevel: LogLevel): void;
}
/**
 * Gets the logger uniquely identified by name.
 *
 * @param name Name of the logger to be created/returned.
 */
export declare function getLogger(name: string): Logger;
/**
 * Sets the log level for a logger or namespace.
 *
 * @param name The name to set the log level for. This can be the name of a
 *   specific logger, or a "namespace" (prefix for a logger name), in which case
 *   it applies to all loggers in that namespace. For example, if you set the
 *   log level for "gcx.api" to Warn, then only warnings or higher will be
 *   logged for any logger whose name begins with "gcx.api". You can specify the
 *   special name "root" which applies to all loggers.
 * @param logLevel The log level.
 */
export declare function setLogLevel(name: string, logLevel: LogLevel): void;
/**
 * Sets the logger factory.
 *
 * @param factory The logger factory. Setting this to undefined will reset it to
 *   the default factory.
 */
export declare function setLoggerFactory(factory: LoggerFactory): void;
/**
 * Resets the module to the default factory implementation.
 */
export declare function reset(): void;
/**
 * Describes an entry to write to the log.
 */
export interface LogEntry {
    /**
     * The log level.
     */
    level: LogLevel;
    /**
     * The timestamp indicating when the entry was created.
     */
    time: Date;
    /**
     * The message to log. It has already been fully formatted and translated.
     */
    message: string;
    /**
     * The language resource key corresponding to the message if one was
     * provided. This can be used along with {@link messageArgs} to re-translate
     * the message into other languages.
     */
    messageResource?: string;
    /**
     * Values for positional placeholders in the message string.
     */
    messageArgs: unknown[];
    /**
     * An error associated with this log entry.
     */
    error?: Error;
}
/**
 * Base class for loggers.
 */
export declare abstract class LoggerBase implements Logger {
    /**
     * The unique name of the logger.
     */
    readonly name: string;
    /**
     * @inheritDoc
     */
    get level(): LogLevel;
    /**
     * @inheritDoc
     */
    set level(logLevel: LogLevel);
    private readonly _logManager;
    /**
     * Initializes a new instance of the {@link LoggerBase} class.
     *
     * @param name The name of the logger.
     * @param logManager The log manager.
     */
    constructor(name: string, logManager: LogManager);
    /**
     * @inheritDoc
     */
    log(level: LogLevel, messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * @inheritDoc
     */
    trace(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * @inheritDoc
     */
    debug(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * @inheritDoc
     */
    info(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * @inheritDoc
     */
    warn(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * @inheritDoc
     */
    error(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * @inheritDoc
     */
    fatal(messageOrOptions: string | LogOptions, ...args: unknown[]): void;
    /**
     * Logs an entry.
     *
     * @param entry The entry to write.
     */
    protected abstract _log(entry: LogEntry): void;
    /**
     * Determine if the level provided is greater or equal to the logger level.
     *
     * @param level The log level.
     * @returns True if greater or equal to logger log level.
     */
    private _shouldLog;
}
/**
 * A class implementing a logger that outputs to the console.
 */
export declare class ConsoleLogger extends LoggerBase {
    /**
     * @inheritDoc
     */
    protected _log(entry: LogEntry): void;
}
export {};
