UNPKG

perfect-logger

Version:

A zero-dependency, isomorphic logger for Node.js and Browsers with plugin support.

42 lines (41 loc) 1.56 kB
import { LoggerConfig, LogEntry } from './types'; import { Logger } from './Logger'; /** * The singleton LogManager class. * It holds the central configuration and dispatches log entries to the appenders. */ export declare class LogManager { private static instance; private config; private constructor(); static getInstance(): LogManager; /** * A convenience method to quickly configure the logger for a typical Node.js backend. * Includes a ConsoleAppender and a FileAppender with sensible defaults. * @param config Overrides for the default backend configuration. */ static simpleBackendConfig(config?: Partial<LoggerConfig>): void; /** * A convenience method to quickly configure the logger for a typical frontend. * Includes a ConsoleAppender with sensible defaults. * @param config Overrides for the default backend configuration. */ static simpleFrontendConfig(config?: Partial<LoggerConfig>): void; /** * Configures the LogManager. This should be called once at application startup. * @param config The configuration object. */ configure(config: Partial<LoggerConfig>): void; /** * Creates a new Logger instance. * @param namespace The name of the logger. * @returns A new Logger. */ getLogger(namespace: string): Logger; /** * Dispatches a log entry to all configured appenders. * This is called by the Logger instances. * @param entry The log entry to dispatch. */ dispatch(entry: LogEntry): void; }