@contrail/telemetry 2.0.10-alpha.0 → 2.0.10-alpha.2
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/index.browser.d.ts +5 -3
- package/lib/index.browser.js +11 -25
- package/package.json +1 -1
package/lib/index.browser.d.ts
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
* Browser-safe entry point for @contrail/telemetry.
|
|
3
3
|
*
|
|
4
4
|
* Webpack 5 / Angular resolve this file via the "browser" field in package.json,
|
|
5
|
-
* avoiding Node built-in imports (stream, async_hooks)
|
|
5
|
+
* avoiding Node built-in imports (stream, async_hooks). Pino's own browser build
|
|
6
|
+
* is pure JS and logs to console, so we use it directly instead of a custom stub.
|
|
6
7
|
*/
|
|
8
|
+
import pino from 'pino';
|
|
7
9
|
import type { Logger } from 'pino';
|
|
8
10
|
export * from './semantic-conventions';
|
|
9
11
|
export { ATTR_LOG_MESSAGE, ATTR_LOG_BODY, ATTR_LOG_PAYLOAD } from './logger/semantic-conventions';
|
|
10
12
|
export { PINO_LEVEL_TO_OTEL_SEVERITY, PINO_LEVEL_TO_NAME } from './logger/logger-config';
|
|
11
13
|
export { parseOtelResourceAttributes } from './logger/parse-otel-resource-attributes';
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const baseLogger: pino.Logger<never, boolean>;
|
|
15
|
+
export declare const logger: pino.Logger<never, boolean>;
|
|
14
16
|
export declare const loggerStorage: {
|
|
15
17
|
getStore: () => any;
|
|
16
18
|
run: <T>(_store: unknown, callback: () => T) => T;
|
package/lib/index.browser.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Browser-safe entry point for @contrail/telemetry.
|
|
4
4
|
*
|
|
5
5
|
* Webpack 5 / Angular resolve this file via the "browser" field in package.json,
|
|
6
|
-
* avoiding Node built-in imports (stream, async_hooks)
|
|
6
|
+
* avoiding Node built-in imports (stream, async_hooks). Pino's own browser build
|
|
7
|
+
* is pure JS and logs to console, so we use it directly instead of a custom stub.
|
|
7
8
|
*/
|
|
8
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
10
|
if (k2 === undefined) k2 = k;
|
|
@@ -19,12 +20,16 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
19
20
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
22
|
};
|
|
23
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
|
+
};
|
|
22
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.withLogContext = exports.loggerStorage = exports.
|
|
27
|
+
exports.withLogContext = exports.loggerStorage = exports.logger = exports.baseLogger = exports.parseOtelResourceAttributes = exports.PINO_LEVEL_TO_NAME = exports.PINO_LEVEL_TO_OTEL_SEVERITY = exports.ATTR_LOG_PAYLOAD = exports.ATTR_LOG_BODY = exports.ATTR_LOG_MESSAGE = void 0;
|
|
24
28
|
exports.withLogAttributes = withLogAttributes;
|
|
25
29
|
exports.createContextAwareLogger = createContextAwareLogger;
|
|
26
30
|
exports.addStream = addStream;
|
|
27
31
|
exports.flushLogs = flushLogs;
|
|
32
|
+
const pino_1 = __importDefault(require("pino"));
|
|
28
33
|
// --- Re-export browser-safe modules as-is ---
|
|
29
34
|
__exportStar(require("./semantic-conventions"), exports);
|
|
30
35
|
var semantic_conventions_1 = require("./logger/semantic-conventions");
|
|
@@ -36,28 +41,9 @@ Object.defineProperty(exports, "PINO_LEVEL_TO_OTEL_SEVERITY", { enumerable: true
|
|
|
36
41
|
Object.defineProperty(exports, "PINO_LEVEL_TO_NAME", { enumerable: true, get: function () { return logger_config_1.PINO_LEVEL_TO_NAME; } });
|
|
37
42
|
var parse_otel_resource_attributes_1 = require("./logger/parse-otel-resource-attributes");
|
|
38
43
|
Object.defineProperty(exports, "parseOtelResourceAttributes", { enumerable: true, get: function () { return parse_otel_resource_attributes_1.parseOtelResourceAttributes; } });
|
|
39
|
-
// ---
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
debug: console.debug.bind(console),
|
|
43
|
-
info: console.log.bind(console),
|
|
44
|
-
warn: console.warn.bind(console),
|
|
45
|
-
error: console.error.bind(console),
|
|
46
|
-
fatal: console.error.bind(console),
|
|
47
|
-
};
|
|
48
|
-
const noopLogger = new Proxy({}, {
|
|
49
|
-
get(_target, prop) {
|
|
50
|
-
if (prop === 'level')
|
|
51
|
-
return 'debug';
|
|
52
|
-
if (prop === 'child')
|
|
53
|
-
return () => noopLogger;
|
|
54
|
-
if (typeof prop === 'string' && prop in methods)
|
|
55
|
-
return methods[prop];
|
|
56
|
-
return () => { };
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
exports.logger = noopLogger;
|
|
60
|
-
exports.baseLogger = noopLogger;
|
|
44
|
+
// --- Browser logger (pino's built-in browser build) ---
|
|
45
|
+
exports.baseLogger = (0, pino_1.default)({ level: 'debug' });
|
|
46
|
+
exports.logger = exports.baseLogger;
|
|
61
47
|
// --- No-op stubs for Node-only features ---
|
|
62
48
|
exports.loggerStorage = {
|
|
63
49
|
getStore: () => undefined,
|
|
@@ -69,7 +55,7 @@ function withLogAttributes(_fields, fn) {
|
|
|
69
55
|
/** @deprecated Use `withLogAttributes` instead. */
|
|
70
56
|
exports.withLogContext = withLogAttributes;
|
|
71
57
|
function createContextAwareLogger(_baseLogger) {
|
|
72
|
-
return
|
|
58
|
+
return _baseLogger;
|
|
73
59
|
}
|
|
74
60
|
function addStream(_streamEntry) { }
|
|
75
61
|
async function flushLogs(_options) { }
|