UNPKG

@finos/legend-shared

Version:
60 lines 2.42 kB
/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { AbstractPlugin, type AbstractPluginManager } from '../application/AbstractPluginManager.js'; export declare enum LOG_LEVEL { DEBUG = 1, INFO = 2, WARN = 3, ERROR = 4, SILENT = 5 } export declare class LogEvent { channel?: string; name: string; timestamp: number; /** * TODO: we should make channel required and potentially name required as well, and for each * channel, there should be a list of known event names. Unknown event name, or wrong channel * will result in error. */ static create(name: string): LogEvent; } export interface LoggerPluginManager extends AbstractPluginManager { getLoggerPlugins(): LoggerPlugin[]; registerLoggerPlugin(plugin: LoggerPlugin): void; } export declare abstract class LoggerPlugin extends AbstractPlugin { private level; setLevel(level: LOG_LEVEL): void; install(pluginManager: LoggerPluginManager): void; protected abstract _debug(event: LogEvent, ...data: unknown[]): void; protected abstract _info(event: LogEvent, ...data: unknown[]): void; protected abstract _warn(event: LogEvent, ...data: unknown[]): void; protected abstract _error(event: LogEvent, ...data: unknown[]): void; debug(event: LogEvent, ...data: unknown[]): void; info(event: LogEvent, ...data: unknown[]): void; warn(event: LogEvent, ...data: unknown[]): void; error(event: LogEvent, ...data: unknown[]): void; } export declare class LogService { private loggers; registerPlugins(loggerPlugins: LoggerPlugin[]): void; debug(event: LogEvent, ...data: unknown[]): void; info(event: LogEvent, ...data: unknown[]): void; warn(event: LogEvent, ...data: unknown[]): void; error(event: LogEvent, ...data: unknown[]): void; } //# sourceMappingURL=LogService.d.ts.map