@sipgate/integration-bridge 0.29.4 → 0.29.5
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/util/logger.util.js
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.warnLogger = exports.errorLogger = exports.infoLogger = void 0;
|
|
4
4
|
const anonymize_key_1 = require("./anonymize-key");
|
|
5
|
+
const api_1 = require("@opentelemetry/api");
|
|
6
|
+
function addMessageToTraceSpan(method, message, args) {
|
|
7
|
+
const span = api_1.trace.getSpan(api_1.context.active());
|
|
8
|
+
if (span) {
|
|
9
|
+
span.addEvent(method, { message, args: args ? args.join(',') : '' });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
5
12
|
/**
|
|
6
13
|
* Logging function equivalent to console.log
|
|
7
14
|
* @param source the context where the log originated from (usually the function name)
|
|
@@ -10,6 +17,7 @@ const anonymize_key_1 = require("./anonymize-key");
|
|
|
10
17
|
* @param args additional data, will be stringified and appended
|
|
11
18
|
*/
|
|
12
19
|
const infoLogger = (source, message, apiKey, ...args) => {
|
|
20
|
+
addMessageToTraceSpan('log', message, args);
|
|
13
21
|
logger(console.info, source, message, apiKey, ...args);
|
|
14
22
|
};
|
|
15
23
|
exports.infoLogger = infoLogger;
|
|
@@ -21,6 +29,7 @@ exports.infoLogger = infoLogger;
|
|
|
21
29
|
* @param args additional data, will be stringified and appended
|
|
22
30
|
*/
|
|
23
31
|
const errorLogger = (source, message, apiKey, ...args) => {
|
|
32
|
+
addMessageToTraceSpan('error', message, args);
|
|
24
33
|
logger(console.error, source, message, apiKey, ...args);
|
|
25
34
|
};
|
|
26
35
|
exports.errorLogger = errorLogger;
|
|
@@ -32,6 +41,7 @@ exports.errorLogger = errorLogger;
|
|
|
32
41
|
* @param args additional data, will be stringified and appended
|
|
33
42
|
*/
|
|
34
43
|
const warnLogger = (source, message, apiKey, ...args) => {
|
|
44
|
+
addMessageToTraceSpan('warn', message, args);
|
|
35
45
|
logger(console.warn, source, message, apiKey, ...args);
|
|
36
46
|
};
|
|
37
47
|
exports.warnLogger = warnLogger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.util.js","sourceRoot":"","sources":["../../src/util/logger.util.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;
|
|
1
|
+
{"version":3,"file":"logger.util.js","sourceRoot":"","sources":["../../src/util/logger.util.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAC/C,4CAAoD;AAEpD,SAAS,qBAAqB,CAC5B,MAAgC,EAChC,OAAe,EACf,IAAgB;IAEhB,MAAM,IAAI,GAAG,WAAK,CAAC,OAAO,CAAC,aAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,IAAI,IAAI,EAAE;QACR,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KACtE;AACH,CAAC;AAED;;;;;;GAMG;AACI,MAAM,UAAU,GAAG,CACxB,MAAc,EACd,OAAe,EACf,MAAe,EACf,GAAG,IAAe,EACZ,EAAE;IACR,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAE5C,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;AACzD,CAAC,CAAC;AATW,QAAA,UAAU,cASrB;AAEF;;;;;;GAMG;AACI,MAAM,WAAW,GAAG,CACzB,MAAc,EACd,OAAe,EACf,MAAe,EACf,GAAG,IAAe,EACZ,EAAE;IACR,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAE9C,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,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