/******************************************************************************** * Copyright (c) 2026 CrossBreeze, EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the MIT License which is available in the project root. * * SPDX-License-Identifier: MIT ********************************************************************************/ import { AbstractLogger, type LogLevel } from '@hydranium/protocol'; import { type interfaces } from '@theia/core/shared/inversify'; import { type OutputChannel, OutputChannelManager } from '@theia/output/lib/browser/output-channel'; /** * Configuration for a {@link ChannelLogger}, supplied once at bind time via * {@link bindChannelLogger} (the framework's `(deps, options)` constructor * shape — the only piece an adopter must provide is the channel name). * * Note there is no log-threshold option here: the threshold is not a per-logger * concern. See {@link ChannelLogger} for why, and * `LogLevelPreferenceContribution` for the owner. */ export interface ChannelLoggerOptions { /** Name of the Theia Output channel lines are written to. */ readonly channelName: string; /** Initial logger component prefix (see `Logger.for`). */ readonly component?: string; } /** Inversify token for the {@link ChannelLoggerOptions} constant (merged with the * interface name — the standard Theia "type + token under one identifier" idiom). */ export declare const ChannelLoggerOptions: unique symbol; /** * Writes client-side lines to a Theia Output channel, formatted to align with * the server-side `LspLogger` so both sides of the conversation interleave * cleanly under the same Output panel entry. Cross-head: the data, LSP, and * GLSP Theia integrations can all reuse it — nothing here is GLSP-specific. * * Concrete and options-configured: adopters wire it with * {@link bindChannelLogger}, supplying {@link ChannelLoggerOptions}, rather * than subclassing to pin a channel name. * * It deliberately owns **no** threshold logic. The threshold is a process-global * shared by every `AbstractLogger`, whereas this class's singleton scope is * whichever container bound it (for a GLSP head, one per diagram) — so applying a * global from here would subscribe a preference listener per container and never * dispose one. `LogLevelPreferenceContribution` owns it instead, at application * scope. This class only formats and appends. */ export declare class ChannelLogger extends AbstractLogger { protected readonly outputChannels: OutputChannelManager; protected readonly options: ChannelLoggerOptions; protected _channel?: OutputChannel; constructor(outputChannels: OutputChannelManager, options: ChannelLoggerOptions, component?: string | undefined); protected get channel(): OutputChannel; protected emit(_level: LogLevel, label: string, message: string, args: readonly unknown[]): void; /** * Allocates a free instance bypassing Inversify, so a derived logger inherits * the same OutputChannelManager + options without going through the container * singleton. Subclasses with additional constructor dependencies must * override and pass the extra args along. */ protected derive(component: string): this; } /** * Inversify token for the browser `Tracer` — a {@link DefaultTracer} over * the {@link ChannelLogger} (emit sink) + the container's {@link Clock}, or a * `SystemClock` when it binds none, + a browser heap reader. The browser head * has no Langium `services.Tracer` slot, so this is how frontend services that * time obtain a tracer: `@inject(ChannelTracer)`. * Bound by {@link bindChannelLogger}. */ export declare const ChannelTracer: unique symbol; /** Reads the requesting class's name from an Inversify context, by walking the * current request up to its parent binding. */ export declare function getRequestParentName(context: interfaces.Context): string | undefined; /** * Bind the {@link ChannelLogger} for an adopter's Theia frontend: * * - `bind(ChannelLoggerOptions).toConstantValue(options)` — the config * - the un-tagged singleton base (private token), constructed by Inversify * - `bind(ChannelLogger).toDynamicValue(...)` — class-scoped per request, so * every `@inject(ChannelLogger)` site gets a logger pre-tagged with the * requesting class name * * Adopters that compose their own module (bypassing a head's module helper) * call this directly; head module helpers (`createGlspClientTheiaModule`) * forward to it. */ export declare function bindChannelLogger(bind: interfaces.Bind, options: ChannelLoggerOptions): void; //# sourceMappingURL=channel-logger.d.ts.map