/
baseDiagnosticLogger.ts
32 lines (27 loc) · 1.28 KB
/
baseDiagnosticLogger.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { IAgentLogger, IDiagnosticLog, IDiagnosticLogger, LOGGER_LANGUAGE, LOGGER_NAME } from "../types";
import { APPLICATION_INSIGHTS_OPENTELEMETRY_VERSION } from "../../types";
export class BaseDiagnosticLogger implements IDiagnosticLogger {
protected _extensionVersion: string;
protected _instrumentationKey: string;
protected _loggerName: string;
protected _language: string;
protected _sdkVersion: string;
protected _siteName: string;
protected _subscriptionId: string;
protected _agentLogger: IAgentLogger;
constructor(instrumentationKey: string, agentLogger: IAgentLogger = console) {
this._agentLogger = agentLogger;
this._instrumentationKey = instrumentationKey;
this._loggerName = LOGGER_NAME;
this._language = LOGGER_LANGUAGE;
this._siteName = process.env.WEBSITE_SITE_NAME;
this._extensionVersion = process.env.ApplicationInsightsAgent_EXTENSION_VERSION;
this._sdkVersion = APPLICATION_INSIGHTS_OPENTELEMETRY_VERSION;
this._subscriptionId = process.env.WEBSITE_OWNER_NAME ? process.env.WEBSITE_OWNER_NAME.split("+")[0] : null;
}
public logMessage(diagnosticLog: IDiagnosticLog) {
// No OP
}
}