UNPKG

@autorest/common

Version:
54 lines 2.45 kB
import { LoggingSession } from "./logging-session"; import { AutorestDiagnostic, AutorestError, AutorestLogger, AutorestWarning, LoggerAsyncProcessor, LoggerProcessor, LoggerSink, LogInfo } from "./types"; import { Progress } from "."; export interface AutorestLoggerBaseOptions<T> { processors?: T[]; sinks: LoggerSink[]; } export declare abstract class AutorestLoggerBase<T> implements AutorestLogger { diagnostics: AutorestDiagnostic[]; protected sinks: LoggerSink[]; protected processors: T[]; constructor(options: AutorestLoggerBaseOptions<T>); debug(message: string): void; verbose(message: string): void; info(message: string): void; fatal(message: string): void; trackWarning(warning: AutorestWarning): void; trackError(error: AutorestError): void; startProgress(initialName?: string): { update: (progress: Progress) => void; stop: () => void; }; protected emitLog(log: LogInfo): void; abstract with(...processors: LoggerProcessor[]): AutorestLogger; abstract trackDiagnostic(diagnostic: AutorestDiagnostic): void; abstract log(log: LogInfo): void; } export interface AutorestLoggerOptions extends AutorestLoggerBaseOptions<LoggerProcessor> { } export declare class AutorestSyncLogger extends AutorestLoggerBase<LoggerProcessor> { diagnostics: AutorestDiagnostic[]; constructor(options: AutorestLoggerOptions); with(...processors: LoggerProcessor[]): AutorestSyncLogger; trackDiagnostic(diagnostic: AutorestDiagnostic): void; log(log: LogInfo): void; protected emitLog(log: LogInfo): void; protected process(log: LogInfo): LogInfo | undefined; } export interface AutorestAsyncLoggerOptions extends AutorestLoggerBaseOptions<LoggerProcessor | LoggerAsyncProcessor> { asyncSession: LoggingSession; } export declare class AutorestAsyncLogger extends AutorestLoggerBase<LoggerProcessor | LoggerAsyncProcessor> { diagnostics: AutorestDiagnostic[]; private asyncSession; constructor(options: AutorestAsyncLoggerOptions); with(...processors: Array<LoggerProcessor | LoggerAsyncProcessor>): AutorestAsyncLogger; protected emitLog(log: LogInfo): void; log(log: LogInfo): void; trackDiagnostic(diagnostic: AutorestDiagnostic): void; private logMessageAsync; private trackDiagnosticAsync; protected process(log: LogInfo): Promise<LogInfo | undefined>; } //# sourceMappingURL=logger.d.ts.map