import { Disposable } from '../../../util/vs/base/common/lifecycle'; export declare const ILogService: import("../../../util/common/services").ServiceIdentifier; /** * Log levels (taken from vscode.d.ts) */ export declare enum LogLevel { /** * No messages are logged with this level. */ Off = 0, /** * All messages are logged with this level. */ Trace = 1, /** * Messages with debug and higher log level are logged with this level. */ Debug = 2, /** * Messages with info and higher log level are logged with this level. */ Info = 3, /** * Messages with warning and higher log level are logged with this level. */ Warning = 4, /** * Only error messages are logged with this level. */ Error = 5 } export interface ILogTarget { logIt(level: LogLevel, metadataStr: string, ...extra: any[]): void; show?(preserveFocus?: boolean): void; } /** * Utility functions for creating ILogTarget instances. */ export declare namespace LogTarget { /** * Creates an ILogTarget from a simple callback function. * * @example * logger.withExtraTarget(LogTarget.fromCallback((level, msg) => { * console.log(`[${LogLevel[level]}] ${msg}`); * })); */ function fromCallback(fn: (level: LogLevel, message: string) => void): ILogTarget; } export declare class ConsoleLog implements ILogTarget { private readonly prefix?; private readonly minLogLevel; constructor(prefix?: string | undefined, minLogLevel?: LogLevel); logIt(level: LogLevel, metadataStr: string, ...extra: any[]): void; } export interface ILogService extends ILogger { readonly _serviceBrand: undefined; } /** * Mirrors vscode's {@link LogOutputChannel} in terms of available logging functions * Args has been ommitted for now in favor of simplifying the interface */ export interface ILogger { trace(message: string): void; debug(message: string): void; info(message: string): void; warn(message: string): void; /** * Logs an error message. Prefer this method over `error()` when logging exception details. * * @param error The Error object that was thrown * @param message An optional message for context (e.g. "Request error"). Must not contain customer data. **Do not include stack trace or messages from the error object.** */ error(error: string | Error, message?: string): void; show(preserveFocus?: boolean): void; /** * Creates a sub-logger with a topic prefix. All messages logged through * the sub-logger will be prefixed with the topic, e.g., `[Topic] message`. * * Sub-loggers can be nested, and the prefixes will accumulate, * e.g., `[Parent][Child] message`. * * Sub-loggers inherit extra targets from their parent. * * @param topic The topic name or array of topic names to prefix messages with */ createSubLogger(topic: string | readonly string[]): ILogger; /** * Returns a new logger that also logs to the specified extra target. * The original logger is unchanged (immutable). * * Can be chained to add multiple targets. Sub-loggers created from this * logger will inherit all extra targets. * * Errors thrown by extra targets are silently caught. * * @param target An ILogTarget instance * @returns A new ILogger with the extra target attached * * @example * const logger = logService * .createSubLogger('MyFeature') * .withExtraTarget(LogTarget.fromCallback((level, msg) => { * logContext.trace(msg); * })); */ withExtraTarget(target: ILogTarget): ILogger; } export declare class LogServiceImpl extends Disposable implements ILogService { _serviceBrand: undefined; readonly logger: LoggerImpl; constructor(logTargets: ILogTarget[]); trace(message: string): void; debug(message: string): void; info(message: string): void; warn(message: string): void; error(error: string | Error, message?: string): void; show(preserveFocus?: boolean): void; createSubLogger(topic: string | readonly string[]): ILogger; withExtraTarget(target: ILogTarget): ILogger; } declare class LoggerImpl implements ILogger { private readonly _logTargets; constructor(_logTargets: ILogTarget[]); private _logIt; trace(message: string): void; debug(message: string): void; info(message: string): void; warn(message: string): void; error(error: string | Error, message?: string): void; show(preserveFocus?: boolean): void; createSubLogger(topic: string | readonly string[]): ILogger; withExtraTarget(target: ILogTarget): ILogger; } export declare function collectErrorMessages(e: any): string; export declare function collectSingleLineErrorMessage(e: any, includeDetails?: boolean): string; /** * Sanitizes a network error message for telemetry by replacing hostnames, * IP addresses, and credentials with placeholders. */ export declare function sanitizeNetworkErrorForTelemetry(message: string): string; /** * Chromium error details attached by Electron to fetch errors. * Electron's network service process runs separately; when it crashes, * `network_process_crashed` is set to `true` on the error's `chromiumDetails`. */ export interface ElectronFetchErrorChromiumDetails { readonly is_request_error?: boolean; readonly network_process_crashed?: boolean; readonly session_state?: any; readonly drain_error?: any; readonly drain_description?: any; readonly go_away_error?: any; readonly go_away_error_details?: any; readonly go_away_debug_data?: any; readonly rst_stream_error?: any; readonly rst_stream_error_details?: any; readonly rst_stream_description?: any; readonly last_framer_error?: any; readonly last_framer_error_details?: any; readonly error_source?: any; readonly aliases?: any; readonly proxy?: any; readonly in_flight_write?: any; readonly buffered_spdy_framer?: any; readonly tls_info?: any; readonly socket_info?: any; readonly url_loader_error?: any; readonly active_stream_details?: any; readonly closed_stream_details?: any; } export declare class LogMemory { private static _logs; private static _requestIds; private static readonly MAX_LOGS; /** * Extracts the requestId from a log message if it matches the expected pattern. * Returns a string in the format 'requestId: {string}' or undefined if not found. */ private static extractRequestIdFromMessage; static addLog(level: string, message: string): void; static getLogs(): string[]; static getRequestIds(): string[]; } export {}; //# sourceMappingURL=logService.d.ts.map