UNPKG

@senacor/azure-function-middleware

Version:

Middleware for azure functions to handle authentication, authorization, error handling and logging

47 lines (46 loc) 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createAppInsightsLogger = void 0; const Contracts_1 = require("applicationinsights/out/Declarations/Contracts"); const stringify_1 = require("../util/stringify"); const createAppInsightsLogger = (telemetryClient) => { return { debug(...args) { telemetryClient.trackTrace({ message: (0, stringify_1.stringify)(args), severity: Contracts_1.SeverityLevel.Verbose, }); }, error(...args) { telemetryClient.trackTrace({ message: (0, stringify_1.stringify)(args), severity: Contracts_1.SeverityLevel.Error, }); }, info(...args) { telemetryClient.trackTrace({ message: (0, stringify_1.stringify)(args), severity: Contracts_1.SeverityLevel.Information, }); }, log(...args) { telemetryClient.trackTrace({ message: (0, stringify_1.stringify)(args), severity: Contracts_1.SeverityLevel.Information, }); }, trace(...args) { telemetryClient.trackTrace({ message: (0, stringify_1.stringify)(args), severity: Contracts_1.SeverityLevel.Verbose, }); }, warn(...args) { telemetryClient.trackTrace({ message: (0, stringify_1.stringify)(args), severity: Contracts_1.SeverityLevel.Warning, }); }, }; }; exports.createAppInsightsLogger = createAppInsightsLogger;