@contrail/telemetry 2.0.7 → 2.0.8-alpha-formatting.0
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/lib/logger/index.js
CHANGED
|
@@ -82,7 +82,6 @@ const otelLoggerProvider = new sdk_logs_1.LoggerProvider({
|
|
|
82
82
|
});
|
|
83
83
|
const otelLogger = otelLoggerProvider.getLogger(serviceName);
|
|
84
84
|
// --- Pino Stream Destinations ---
|
|
85
|
-
const stdout_writer_1 = require("./stdout-writer");
|
|
86
85
|
function isPinoPrettyInstalled() {
|
|
87
86
|
try {
|
|
88
87
|
require.resolve('pino-pretty');
|
|
@@ -125,7 +124,7 @@ function createStdoutStream() {
|
|
|
125
124
|
catch {
|
|
126
125
|
line = chunk.toString().replace(/\n$/, '');
|
|
127
126
|
}
|
|
128
|
-
|
|
127
|
+
console.log(line);
|
|
129
128
|
callback();
|
|
130
129
|
},
|
|
131
130
|
}),
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stdoutWriter = void 0;
|
|
4
|
-
// Capture console.log so we can use it from the pino stdout stream.
|
|
5
|
-
// Lambda treats each console.log() call as a single CloudWatch log event (even with
|
|
6
|
-
// embedded newlines), unlike process.stdout.write() which splits on \n.
|
|
7
|
-
//
|
|
8
|
-
// Guard: app-framework's hijackConsole() replaces console.log with overridenLog,
|
|
9
|
-
// which routes back into pino — using it here would create an infinite loop.
|
|
10
|
-
// Any other console.log replacement (e.g. the OTel Lambda layer) is safe to use.
|
|
11
|
-
const _capturedConsoleLog = console.log;
|
|
12
|
-
const isConsoleHijacked = _capturedConsoleLog.name === 'overridenLog';
|
|
13
|
-
// Wrapped in an object so tests can jest.spyOn(stdoutWriter, 'log') regardless
|
|
14
|
-
// of Jest's console patching strategy (BufferedConsole vs CustomConsole).
|
|
15
|
-
exports.stdoutWriter = {
|
|
16
|
-
log: isConsoleHijacked
|
|
17
|
-
? (...args) => process.stdout.write(args.map(String).join(' ') + '\n')
|
|
18
|
-
: _capturedConsoleLog,
|
|
19
|
-
};
|