Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Commit

Permalink
Extract constants
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w committed Jul 6, 2017
1 parent 6f34ceb commit a9f93b0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/clients/appinsights/AppInsightsClient.js
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit a9f93b0

Please sign in to comment.