applicationinsights
Version:
Microsoft Application Insights module for Node.js
27 lines • 1.15 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
exports.AzureFunctionsWriter = void 0;
const types_1 = require("../../../types");
const types_2 = require("../../types");
const AZURE_FUNCTIONS_DIAGNOSTIC_PREFIX = "LanguageWorkerConsoleLogMS_APPLICATION_INSIGHTS_LOGS";
class AzureFunctionsWriter {
constructor(instrumentationKey) {
this._instrumentationKey = instrumentationKey;
this._appName = types_2.AZURE_APP_NAME;
this._agentVersion = types_1.APPLICATION_INSIGHTS_OPENTELEMETRY_VERSION;
}
log(log) {
console.info(this._getAzureFnLog(log));
}
error(log) {
console.error(this._getAzureFnLog(log));
}
_getAzureFnLog(log) {
const output = `${AZURE_FUNCTIONS_DIAGNOSTIC_PREFIX} ${log.time},${log.level},${log.logger},\"${log.message}\",${this._appName},${this._instrumentationKey},${this._agentVersion},node.js`;
return output;
}
}
exports.AzureFunctionsWriter = AzureFunctionsWriter;
//# sourceMappingURL=azureFunctionsWriter.js.map
;