Skip to content

Commit

Permalink
Invert the echo
Browse files Browse the repository at this point in the history
  • Loading branch information
ljones140 committed Oct 18, 2024
1 parent ef89a38 commit 3d67f43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions providers/logging/insights.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
const appInsights = require('applicationinsights')

class Insights {
constructor(tattoos, client = null, echo = true) {
constructor(options, client = null, echo = false) {
this.client = client
this.tattoos = tattoos
this.options = options
this.echo = echo
}

static setup(tattoos, key = 'mock', echo = true) {
static setup(options, key = 'mock', echo = false) {
// exit if we are already setup
if (appInsights.defaultClient instanceof Insights) return
if (!key || key === 'mock') appInsights.defaultClient = new Insights(tattoos, null, echo)
if (!key || key === 'mock') appInsights.defaultClient = new Insights(options, null, echo)
else {
appInsights.setup(key).setAutoCollectPerformance(false).setAutoCollectDependencies(false).start()
appInsights.defaultClient = new Insights(tattoos, appInsights.defaultClient, echo)
appInsights.defaultClient = new Insights(options, appInsights.defaultClient, echo)
}
}

Expand All @@ -43,7 +43,7 @@ class Insights {
}

tattoo(telemetry) {
telemetry.properties = { ...(telemetry.properties || {}), ...this.tattoos }
telemetry.properties = { ...(telemetry.properties || {}), ...this.options }
}
}
module.exports = Insights
4 changes: 2 additions & 2 deletions providers/logging/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const aiLogger = require('winston-azure-application-insights').AzureApplicationI
const winston = require('winston')
const insights = require('./insights')

function factory(tattoos) {
insights.setup(tattoos, config.get('CRAWLER_INSIGHTS_KEY'), config.get('CRAWLER_ECHO'))
function factory(options) {
insights.setup(options, config.get('CRAWLER_INSIGHTS_KEY'), config.get('CRAWLER_ECHO'))
const result = new winston.Logger()
result.add(aiLogger, {
insights: appInsights,
Expand Down

0 comments on commit 3d67f43

Please sign in to comment.