MCPcopy
hub / github.com/microsoft/vscode-js-debug / ProxyLogger

Class ProxyLogger

src/common/logging/proxyLogger.ts:7–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import { ILogger, ILogItem, LogLevel, LogTag } from '.';
6
7export class ProxyLogger implements ILogger {
8 private target?: { logger: ILogger } | { queue: ILogItem[] } = { queue: [] };
9
10 /**
11 * Connects this logger to the given instance.
12 */
13 public connectTo(logger: ILogger) {
14 this.target = { logger };
15 }
16
17 /**
18 * @inheritdoc
19 */
20 public info(tag: LogTag, msg?: string, metadata?: unknown): void {
21 this.log({
22 tag,
23 timestamp: Date.now(),
24 message: msg,
25 metadata,
26 level: LogLevel.Info,
27 });
28 }
29
30 /**
31 * @inheritdoc
32 */
33 public verbose(tag: LogTag, msg?: string, metadata?: unknown): void {
34 this.log({
35 tag,
36 timestamp: Date.now(),
37 message: msg,
38 metadata,
39 level: LogLevel.Verbose,
40 });
41 }
42
43 /**
44 * @inheritdoc
45 */
46 public warn(tag: LogTag, msg?: string, metadata?: unknown): void {
47 this.log({
48 tag,
49 timestamp: Date.now(),
50 message: msg,
51 metadata,
52 level: LogLevel.Warn,
53 });
54 }
55
56 /**
57 * @inheritdoc
58 */
59 public error(tag: LogTag, msg?: string, metadata?: unknown): void {
60 this.log({
61 tag,
62 timestamp: Date.now(),
63 message: msg,
64 metadata,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected