@mhubcloud/tms_core 3.1.6-beta.5 → 3.1.6-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ var crypto = __toESM(require("crypto"));
57
57
  var appInsights = __toESM(require("applicationinsights"));
58
58
  var aiClient = null;
59
59
  if (process.env.APPLICATIONINSIGHTS_CONNECTION_STRING || process.env.APPINSIGHTS_INSTRUMENTATIONKEY) {
60
- appInsights.setup().setAutoCollectDependencies(false).setAutoCollectConsole(true, true).setSendLiveMetrics(false).setAutoCollectRequests(false).setAutoCollectPerformance(false).setUseDiskRetryCaching(false).start();
60
+ appInsights.setup().setAutoCollectDependencies(false).setAutoCollectConsole(true, false).setSendLiveMetrics(false).setAutoCollectRequests(false).setAutoCollectPerformance(false).setUseDiskRetryCaching(false).start();
61
61
  aiClient = appInsights.defaultClient;
62
62
  }
63
63
  var EventPublisherBase = class {
@@ -81,8 +81,13 @@ var EventPublisherBase = class {
81
81
  );
82
82
  }
83
83
  };
84
- function logMessage(log2, level, message, properties) {
85
- log2.warn(message, properties);
84
+ function logMessage(level, message, properties) {
85
+ console.log(message);
86
+ aiClient?.trackTrace({
87
+ message,
88
+ severity: level,
89
+ properties
90
+ });
86
91
  }
87
92
  function logEvent(publisher2, event, region) {
88
93
  const properties = {
@@ -90,14 +95,10 @@ function logEvent(publisher2, event, region) {
90
95
  event,
91
96
  region
92
97
  };
93
- aiClient?.trackTrace({
94
- message: "Event dispatched to platform",
95
- severity: 1,
96
- properties
97
- });
98
+ logMessage(1, "Event dispatched to platform", properties);
98
99
  }
99
100
  function logException(log2, exception) {
100
- log2.warn(exception.message);
101
+ aiClient?.trackException({ exception });
101
102
  }
102
103
  function removeUndefined(originalValue) {
103
104
  if (originalValue instanceof Array) {
@@ -399,7 +400,6 @@ var cj = {
399
400
  async publish(log2, config, data, event) {
400
401
  if (!data.cjevent) {
401
402
  logMessage(
402
- log2,
403
403
  1,
404
404
  `CJ - ${event.event} - skipped because CJEVENT is missing`
405
405
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhubcloud/tms_core",
3
- "version": "3.1.6-beta.5",
3
+ "version": "3.1.6-beta.6",
4
4
  "description": "Core function for mHub Cloud TMS publishers",
5
5
  "homepage": "https://mhubcloud.com/",
6
6
  "license": "Apache 2.0",
@@ -22,7 +22,6 @@ export const cj: PlatformPublisher = {
22
22
  async publish(log, config, data, event) {
23
23
  if (!(data as CjData).cjevent) {
24
24
  utils.logMessage(
25
- log,
26
25
  1,
27
26
  `CJ - ${event.event} - skipped because CJEVENT is missing`,
28
27
  );
@@ -17,9 +17,9 @@ if (
17
17
  process.env.APPINSIGHTS_INSTRUMENTATIONKEY
18
18
  ) {
19
19
  appInsights
20
- .setup() // Set environment variable APPINSIGHTS_INSTRUMENTATIONKEY, so setup() can be called w/o parameters
20
+ .setup() // Set environment variable APPLICATIONINSIGHTS_CONNECTION_STRING, so setup() can be called w/o parameters
21
21
  .setAutoCollectDependencies(false)
22
- .setAutoCollectConsole(true, true)
22
+ .setAutoCollectConsole(true, false)
23
23
  .setSendLiveMetrics(false)
24
24
  .setAutoCollectRequests(false)
25
25
  .setAutoCollectPerformance(false)
@@ -60,12 +60,16 @@ export class EventPublisherBase implements EventPublisherBaseClass {
60
60
  * Logs message to Azure Function context and to Application Insights (if configured)
61
61
  */
62
62
  export function logMessage(
63
- log: Logger,
64
63
  level: SeverityLevel,
65
64
  message: string,
66
65
  properties?: Telemetry['properties'],
67
66
  ): void {
68
- log.warn(message, properties);
67
+ console.log(message);
68
+ aiClient?.trackTrace({
69
+ message,
70
+ severity: level,
71
+ properties,
72
+ });
69
73
  }
70
74
 
71
75
  export function logEvent(
@@ -78,18 +82,15 @@ export function logEvent(
78
82
  event: event,
79
83
  region: region,
80
84
  };
81
- aiClient?.trackTrace({
82
- message: 'Event dispatched to platform',
83
- severity: 1,
84
- properties,
85
- });
85
+ logMessage(1, 'Event dispatched to platform', properties);
86
86
  }
87
87
 
88
88
  /**
89
89
  * Logs exception to Azure Function context and to Application Insights (if configured)
90
90
  */
91
91
  export function logException(log: Logger, exception: Error) {
92
- log.warn(exception.message);
92
+ // log.warn(exception.message);
93
+ aiClient?.trackException({ exception: exception });
93
94
  }
94
95
 
95
96
  /**