logIpc.ts ×17

Frontier kind: Code frontier

unlabeled · c_5aaee12529f8

8 tests · 10351 LOC · 47 files · introduces 0 tests · 79 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
17 ranges79 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1725 ranges10351 lines · 47 files · Browse complete extent
All tests (intent)
8 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 79 introduced LOC across 17 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/log/common/logIpc.ts 79 introduced LOC · 17 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- logIpc.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { URI } from '../../../base/common/uri.js';
7 > import { Event } from '../../../base/common/event.js';
8 > import { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';
9 > import { AbstractLoggerService, AbstractMessageLogger, AdapterLogger, DidChangeLoggersEvent, ILogger, ILoggerOptions, ILoggerResource, ILoggerService, isLogLevel, LogLevel } from './log.js';
10 > import { Disposable } from '../../../base/common/lifecycle.js';
11 > import { IURITransformer } from '../../../base/common/uriIpc.js';
12 >
13 > export class LoggerChannelClient extends AbstractLoggerService implements ILoggerService {
14 >
15 > constructor(private readonly windowId: number | undefined, logLevel: LogLevel, logsHome: URI, loggers: ILoggerResource[], private readonly channel: IChannel) {
16 super(logLevel, logsHome, loggers);
17 this._register(channel.listen<LogLevel | [URI, LogLevel]>('onDidChangeLogLevel', windowId)(arg => {
32 }));
33 }
34 > logIpc.ts
35 > createConsoleMainLogger(): ILogger {
36 return new AdapterLogger({
37 log: (level: LogLevel, args: any[]) => {
40 });
41 }
42 > logIpc.ts
43 > override registerLogger(logger: ILoggerResource): void {
44 super.registerLogger(logger);
45 this.channel.call('registerLogger', [logger, this.windowId]);
46 }
47 > logIpc.ts
48 > override deregisterLogger(idOrResource: URI | string): void {
49 const resource = this.toResource(idOrResource);
50 super.deregisterLogger(resource);
51 this.channel.call('deregisterLogger', [resource, this.windowId]);
52 }
53 > logIpc.ts
54 > override setLogLevel(logLevel: LogLevel): void;
55 > override setLogLevel(resource: URI, logLevel: LogLevel): void;
56 > override setLogLevel(arg1: any, arg2?: any): void {
57 super.setLogLevel(arg1, arg2);
58 this.channel.call('setLogLevel', [arg1, arg2]);
59 }
60 > logIpc.ts
61 > override setVisibility(resourceOrId: URI | string, visibility: boolean): void {
62 super.setVisibility(resourceOrId, visibility);
63 this.channel.call('setVisibility', [this.toResource(resourceOrId), visibility]);
64 }
65 > logIpc.ts
66 > protected doCreateLogger(file: URI, logLevel: LogLevel, options?: ILoggerOptions): ILogger {
67 return new Logger(this.channel, file, logLevel, options, this.windowId);
68 }
69 > logIpc.ts
70 > public static setLogLevel(channel: IChannel, level: LogLevel): Promise<void>;
71 > public static setLogLevel(channel: IChannel, resource: URI, level: LogLevel): Promise<void>;
72 > public static setLogLevel(channel: IChannel, arg1: any, arg2?: any): Promise<void> {
73 return channel.call('setLogLevel', [arg1, arg2]);
74 }
75 > logIpc.ts
76 > }
77 >
78 > class Logger extends AbstractMessageLogger {
79 >
80 > private isLoggerCreated: boolean = false;
81 > private buffer: [LogLevel, string][] = [];
82 >
83 > constructor(
84 private readonly channel: IChannel,
85 private readonly file: URI,
96 });
97 }
98 > logIpc.ts
99 > protected log(level: LogLevel, message: string) {
100 const messages: [LogLevel, string][] = [[level, message]];
101 if (this.isLoggerCreated) {
105 }
106 }
107 > logIpc.ts
108 > private doLog(messages: [LogLevel, string][]) {
109 this.channel.call('log', [this.file, messages]);
110 }
111 > } logIpc.ts
112 >
113 > export class LoggerChannel implements IServerChannel {
114 >
115 > constructor(private readonly loggerService: ILoggerService, private getUriTransformer: (requestContext: any) => IURITransformer) { }
116 >
117 > listen(context: any, event: string): Event<any> {
118 const uriTransformer = this.getUriTransformer(context);
119 switch (event) {
128 throw new Error(`Event not found: ${event}`);
129 }
130 > logIpc.ts
131 > async call(context: any, command: string, arg?: any): Promise<any> {
132 const uriTransformer: IURITransformer | null = this.getUriTransformer(context);
133 switch (command) {
138 throw new Error(`Call not found: ${command}`);
139 }
140 > logIpc.ts
141 > private transformLogger(logger: ILoggerResource, transformer: IURITransformer): ILoggerResource {
142 return {
143 ...logger,
145 };
146 }
147 > logIpc.ts
148 > }
149 >
150 > export class RemoteLoggerChannelClient extends Disposable {
151 >
152 > constructor(loggerService: ILoggerService, channel: IChannel) {
153 > super();
154 >
155 > channel.call('setLogLevel', [loggerService.getLogLevel()]);
156 > this._register(loggerService.onDidChangeLogLevel(arg => channel.call('setLogLevel', [arg])));
157 >
158 > channel.call<ILoggerResource[]>('getRegisteredLoggers').then(loggers => {
159 > for (const loggerResource of loggers) {
160 loggerService.registerLogger({ ...loggerResource, resource: URI.revive(loggerResource.resource) });
161 }
162 > }); logIpc.ts
163 >
164 > this._register(channel.listen<[URI, boolean]>('onDidChangeVisibility')(([resource, visibility]) => loggerService.setVisibility(URI.revive(resource), visibility)));
165 >
166 > this._register(channel.listen<DidChangeLoggersEvent>('onDidChangeLoggers')(({ added, removed }) => {
167 for (const loggerResource of added) {
168 loggerService.registerLogger({ ...loggerResource, resource: URI.revive(loggerResource.resource) });
171 loggerService.deregisterLogger(loggerResource.resource);
172 }
173 > })); logIpc.ts
174 >
175 > }
176 > }