otlpLogEmitter.ts ×7

Frontier kind: Code frontier

unlabeled · c_f6f83fdc9934

3 tests · 8325 LOC · 38 files · introduces 0 tests · 51 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges51 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1360 ranges8325 lines · 38 files · Browse complete extent
All tests (intent)
3 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.

2 files ranked by introduced lines: 51 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/common/otlp/otlpLogEmitter.ts 33 introduced LOC · 7 ranges

Open complete file

188
189 constructor(
190 > private readonly _emitter: OtlpLogEmitter, otlpLogEmitter.ts
191 > initialLevel: LogLevel = LogLevel.Trace,
192 > ) {
193 > super();
194 > // Default to `Trace` so the parent `LogService`'s level check is
195 > // the single source of truth and we don't accidentally drop
196 > // records the file logger printed. The protocol's `{level}`
197 > // filter is applied per-subscriber later on.
198 > this.setLevel(initialLevel);
199 > }
200
201 override trace(message: string, ...args: unknown[]): void {
212
213 override info(message: string, ...args: unknown[]): void {
214 > if (this.canLog(LogLevel.Info)) { otlpLogEmitter.ts
215 this._emit(LogLevel.Info, message, args);
216 }
218
219 override warn(message: string, ...args: unknown[]): void {
220 > if (this.canLog(LogLevel.Warning)) { otlpLogEmitter.ts
221 > this._emit(LogLevel.Warning, message, args);
222 > }
223 > }
224
225 override error(message: string | Error, ...args: unknown[]): void {
245 */
246 private _emit(level: LogLevel, message: string, args: unknown[], verbose = false): void {
247 > let attributes: Readonly<Record<string, OtelAttributeValue>> | undefined; otlpLogEmitter.ts
248 > const index = args.findIndex(arg => arg instanceof OtelData);
249 > if (index !== -1) {
250 attributes = (args[index] as OtelData).attributes;
251 args = args.slice(0, index).concat(args.slice(index + 1));
252 }
253 > const { severityNumber, severityText } = logLevelToOtlpSeverity(level); otlpLogEmitter.ts
254 > this._emitter.emit({
255 > timeUnixNano: msToUnixNano(Date.now()),
256 > severityNumber,
257 > severityText,
258 > body: format([message, ...args], verbose),
259 > ...(attributes ? { attributes } : undefined),
260 > });
261 > }
262 }
263
450 * precision on the producer side, so we just pad with `'000000'`.
451 */
452 > function msToUnixNano(ms: number): string { otlpLogEmitter.ts
453 > // Avoid `BigInt` so this works in renderers and worker environments
454 > // that block `bigint` in JSON serialization paths.
455 > return `${ms}000000`;
456 > }
457
458 /**
src/vs/platform/log/common/log.ts 18 introduced LOC · 5 ranges

Open complete file

179
180 export function format(args: any, verbose: boolean = false): string {
181 > let result = ''; log.ts
182 >
183 > for (let i = 0; i < args.length; i++) {
184 > let a = args[i];
185 >
186 > if (a instanceof Error) {
187 a = toErrorMessage(a, verbose);
188 }
189 > log.ts
190 > if (typeof a === 'object') {
191 try {
192 a = JSON.stringify(a);
193 } catch (e) { }
194 }
195 > log.ts
196 > result += (i > 0 ? ' ' : '') + a;
197 > }
198 >
199 > return result;
200 > }
201
202 export type LoggerGroup = {
397
398 constructor(private readonly logAlways?: boolean) {
399 > super(); log.ts
400 > }
401
402 protected override checkLogLevel(level: LogLevel): boolean {
403 > return this.logAlways || super.checkLogLevel(level); log.ts
404 > }
405
406 trace(message: string, ...args: unknown[]): void {