From a9f93b01a516f7cac41bf81cdbdee8e710e9505b Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Thu, 6 Jul 2017 10:12:40 -0700 Subject: [PATCH] Extract constants --- src/clients/appinsights/AppInsightsClient.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/clients/appinsights/AppInsightsClient.js b/src/clients/appinsights/AppInsightsClient.js index 1b2810a..8c210eb 100644 --- a/src/clients/appinsights/AppInsightsClient.js +++ b/src/clients/appinsights/AppInsightsClient.js @@ -5,15 +5,19 @@ let consoleLog = console.log; let consoleError = console.error; let consoleWarn = console.warn; +const TRACE_LEVEL_INFO = 1; +const TRACE_LEVEL_WARNING = 2; +const TRACE_LEVEL_ERROR = 3; + function setup() { if (appInsightsKey) { const appInsights = require('applicationinsights'); appInsights.setup(appInsightsKey); appInsights.start(); client = appInsights.getClient(appInsightsKey); - console.log = trackTrace(/* INFO */ 1, consoleLog); - console.error = trackTrace(/* ERROR */ 3, consoleError); - console.warn = trackTrace(/* WARNING */ 2, consoleWarn); + console.log = trackTrace(TRACE_LEVEL_INFO, consoleLog); + console.warn = trackTrace(TRACE_LEVEL_WARNING, consoleWarn); + console.error = trackTrace(TRACE_LEVEL_ERROR, consoleError); } }