@livekit/agents 1.0.32 → 1.0.33
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/log.cjs +3 -3
- package/dist/log.cjs.map +1 -1
- package/dist/log.d.cts +0 -5
- package/dist/log.d.ts +0 -5
- package/dist/log.d.ts.map +1 -1
- package/dist/log.js +3 -3
- package/dist/log.js.map +1 -1
- package/package.json +1 -1
- package/src/log.ts +3 -9
package/dist/log.cjs
CHANGED
|
@@ -64,12 +64,12 @@ const enableOtelLogging = () => {
|
|
|
64
64
|
}
|
|
65
65
|
otelEnabled = true;
|
|
66
66
|
const { pretty, level } = loggerOptions;
|
|
67
|
-
const
|
|
67
|
+
const logLevel = level || "info";
|
|
68
68
|
const streams = [
|
|
69
|
-
{ stream: pretty ? (0, import_pino_pretty.build)({ colorize: true }) : process.stdout, level:
|
|
69
|
+
{ stream: pretty ? (0, import_pino_pretty.build)({ colorize: true }) : process.stdout, level: logLevel },
|
|
70
70
|
{ stream: new OtelDestination(), level: "debug" }
|
|
71
71
|
];
|
|
72
|
-
logger = (0, import_pino.pino)({ level:
|
|
72
|
+
logger = (0, import_pino.pino)({ level: logLevel }, (0, import_pino.multistream)(streams));
|
|
73
73
|
};
|
|
74
74
|
// Annotate the CommonJS export names for ESM import in node:
|
|
75
75
|
0 && (module.exports = {
|
package/dist/log.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/log.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Writable } from 'node:stream';\nimport type { DestinationStream, Logger } from 'pino';\nimport { multistream, pino } from 'pino';\nimport { build as pinoPretty } from 'pino-pretty';\nimport { type PinoLogObject, emitToOtel } from './telemetry/pino_otel_transport.js';\n\n/** @internal */\nexport type LoggerOptions = {\n pretty: boolean;\n level?: string;\n};\n\n/** @internal */\nexport let loggerOptions: LoggerOptions;\n\n/** @internal */\nlet logger: Logger | undefined = undefined;\n\n/** @internal */\nlet otelEnabled = false;\n\n/** @internal */\nexport const log = () => {\n if (!logger) {\n throw new TypeError('logger not initialized. did you forget to run initializeLogger()?');\n }\n return logger;\n};\n\n/** @internal */\nexport const initializeLogger = ({ pretty, level }: LoggerOptions) => {\n loggerOptions = { pretty, level };\n logger = pino(\n { level: level || 'info' },\n pretty ? pinoPretty({ colorize: true }) : process.stdout,\n );\n};\n\n/**\n * Custom Pino destination that parses JSON logs and emits to OTEL.\n * This receives the FULL serialized log including msg, level, time, etc.\n */\nclass OtelDestination extends Writable {\n _write(chunk: Buffer, _encoding: string, callback: (error?: Error | null) => void): void {\n try {\n const line = chunk.toString().trim();\n if (line) {\n const logObj = JSON.parse(line) as PinoLogObject;\n emitToOtel(logObj);\n }\n } catch {\n // Ignore parse errors (e.g., non-JSON lines)\n }\n callback();\n }\n}\n\n/**\n * Enable OTEL logging by reconfiguring the logger with multistream.\n * Uses a custom destination that receives full JSON logs (with msg, level, time).\n *\n *
|
|
1
|
+
{"version":3,"sources":["../src/log.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Writable } from 'node:stream';\nimport type { DestinationStream, Logger } from 'pino';\nimport { multistream, pino } from 'pino';\nimport { build as pinoPretty } from 'pino-pretty';\nimport { type PinoLogObject, emitToOtel } from './telemetry/pino_otel_transport.js';\n\n/** @internal */\nexport type LoggerOptions = {\n pretty: boolean;\n level?: string;\n};\n\n/** @internal */\nexport let loggerOptions: LoggerOptions;\n\n/** @internal */\nlet logger: Logger | undefined = undefined;\n\n/** @internal */\nlet otelEnabled = false;\n\n/** @internal */\nexport const log = () => {\n if (!logger) {\n throw new TypeError('logger not initialized. did you forget to run initializeLogger()?');\n }\n return logger;\n};\n\n/** @internal */\nexport const initializeLogger = ({ pretty, level }: LoggerOptions) => {\n loggerOptions = { pretty, level };\n logger = pino(\n { level: level || 'info' },\n pretty ? pinoPretty({ colorize: true }) : process.stdout,\n );\n};\n\n/**\n * Custom Pino destination that parses JSON logs and emits to OTEL.\n * This receives the FULL serialized log including msg, level, time, etc.\n */\nclass OtelDestination extends Writable {\n _write(chunk: Buffer, _encoding: string, callback: (error?: Error | null) => void): void {\n try {\n const line = chunk.toString().trim();\n if (line) {\n const logObj = JSON.parse(line) as PinoLogObject;\n emitToOtel(logObj);\n }\n } catch {\n // Ignore parse errors (e.g., non-JSON lines)\n }\n callback();\n }\n}\n\n/**\n * Enable OTEL logging by reconfiguring the logger with multistream.\n * Uses a custom destination that receives full JSON logs (with msg, level, time).\n *\n * @internal\n */\nexport const enableOtelLogging = () => {\n if (otelEnabled || !logger) {\n console.warn('OTEL logging already enabled or logger not initialized');\n return;\n }\n otelEnabled = true;\n\n const { pretty, level } = loggerOptions;\n\n const logLevel = level || 'info';\n const streams: { stream: DestinationStream; level: string }[] = [\n { stream: pretty ? pinoPretty({ colorize: true }) : process.stdout, level: logLevel },\n { stream: new OtelDestination(), level: 'debug' },\n ];\n\n logger = pino({ level: logLevel }, multistream(streams));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAyB;AAEzB,kBAAkC;AAClC,yBAAoC;AACpC,iCAA+C;AASxC,IAAI;AAGX,IAAI,SAA6B;AAGjC,IAAI,cAAc;AAGX,MAAM,MAAM,MAAM;AACvB,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,UAAU,mEAAmE;AAAA,EACzF;AACA,SAAO;AACT;AAGO,MAAM,mBAAmB,CAAC,EAAE,QAAQ,MAAM,MAAqB;AACpE,kBAAgB,EAAE,QAAQ,MAAM;AAChC,eAAS;AAAA,IACP,EAAE,OAAO,SAAS,OAAO;AAAA,IACzB,aAAS,mBAAAA,OAAW,EAAE,UAAU,KAAK,CAAC,IAAI,QAAQ;AAAA,EACpD;AACF;AAMA,MAAM,wBAAwB,4BAAS;AAAA,EACrC,OAAO,OAAe,WAAmB,UAAgD;AACvF,QAAI;AACF,YAAM,OAAO,MAAM,SAAS,EAAE,KAAK;AACnC,UAAI,MAAM;AACR,cAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,mDAAW,MAAM;AAAA,MACnB;AAAA,IACF,QAAQ;AAAA,IAER;AACA,aAAS;AAAA,EACX;AACF;AAQO,MAAM,oBAAoB,MAAM;AACrC,MAAI,eAAe,CAAC,QAAQ;AAC1B,YAAQ,KAAK,wDAAwD;AACrE;AAAA,EACF;AACA,gBAAc;AAEd,QAAM,EAAE,QAAQ,MAAM,IAAI;AAE1B,QAAM,WAAW,SAAS;AAC1B,QAAM,UAA0D;AAAA,IAC9D,EAAE,QAAQ,aAAS,mBAAAA,OAAW,EAAE,UAAU,KAAK,CAAC,IAAI,QAAQ,QAAQ,OAAO,SAAS;AAAA,IACpF,EAAE,QAAQ,IAAI,gBAAgB,GAAG,OAAO,QAAQ;AAAA,EAClD;AAEA,eAAS,kBAAK,EAAE,OAAO,SAAS,OAAG,yBAAY,OAAO,CAAC;AACzD;","names":["pinoPretty"]}
|
package/dist/log.d.cts
CHANGED
|
@@ -14,11 +14,6 @@ export declare const initializeLogger: ({ pretty, level }: LoggerOptions) => voi
|
|
|
14
14
|
* Enable OTEL logging by reconfiguring the logger with multistream.
|
|
15
15
|
* Uses a custom destination that receives full JSON logs (with msg, level, time).
|
|
16
16
|
*
|
|
17
|
-
* The base logger level is set to 'debug' so all logs are generated,
|
|
18
|
-
* while each stream filters to its own level:
|
|
19
|
-
* - Terminal: user-specified level (default: 'info')
|
|
20
|
-
* - OTEL/Cloud: always 'debug' to capture all logs for observability
|
|
21
|
-
*
|
|
22
17
|
* @internal
|
|
23
18
|
*/
|
|
24
19
|
export declare const enableOtelLogging: () => void;
|
package/dist/log.d.ts
CHANGED
|
@@ -14,11 +14,6 @@ export declare const initializeLogger: ({ pretty, level }: LoggerOptions) => voi
|
|
|
14
14
|
* Enable OTEL logging by reconfiguring the logger with multistream.
|
|
15
15
|
* Uses a custom destination that receives full JSON logs (with msg, level, time).
|
|
16
16
|
*
|
|
17
|
-
* The base logger level is set to 'debug' so all logs are generated,
|
|
18
|
-
* while each stream filters to its own level:
|
|
19
|
-
* - Terminal: user-specified level (default: 'info')
|
|
20
|
-
* - OTEL/Cloud: always 'debug' to capture all logs for observability
|
|
21
|
-
*
|
|
22
17
|
* @internal
|
|
23
18
|
*/
|
|
24
19
|
export declare const enableOtelLogging: () => void;
|
package/dist/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAqB,MAAM,EAAE,MAAM,MAAM,CAAC;AAKtD,gBAAgB;AAChB,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gBAAgB;AAChB,eAAO,IAAI,aAAa,EAAE,aAAa,CAAC;AAQxC,gBAAgB;AAChB,eAAO,MAAM,GAAG,cAKf,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,gBAAgB,sBAAuB,aAAa,SAMhE,CAAC;AAqBF
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAqB,MAAM,EAAE,MAAM,MAAM,CAAC;AAKtD,gBAAgB;AAChB,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gBAAgB;AAChB,eAAO,IAAI,aAAa,EAAE,aAAa,CAAC;AAQxC,gBAAgB;AAChB,eAAO,MAAM,GAAG,cAKf,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,gBAAgB,sBAAuB,aAAa,SAMhE,CAAC;AAqBF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,YAgB7B,CAAC"}
|
package/dist/log.js
CHANGED
|
@@ -38,12 +38,12 @@ const enableOtelLogging = () => {
|
|
|
38
38
|
}
|
|
39
39
|
otelEnabled = true;
|
|
40
40
|
const { pretty, level } = loggerOptions;
|
|
41
|
-
const
|
|
41
|
+
const logLevel = level || "info";
|
|
42
42
|
const streams = [
|
|
43
|
-
{ stream: pretty ? pinoPretty({ colorize: true }) : process.stdout, level:
|
|
43
|
+
{ stream: pretty ? pinoPretty({ colorize: true }) : process.stdout, level: logLevel },
|
|
44
44
|
{ stream: new OtelDestination(), level: "debug" }
|
|
45
45
|
];
|
|
46
|
-
logger = pino({ level:
|
|
46
|
+
logger = pino({ level: logLevel }, multistream(streams));
|
|
47
47
|
};
|
|
48
48
|
export {
|
|
49
49
|
enableOtelLogging,
|
package/dist/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/log.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Writable } from 'node:stream';\nimport type { DestinationStream, Logger } from 'pino';\nimport { multistream, pino } from 'pino';\nimport { build as pinoPretty } from 'pino-pretty';\nimport { type PinoLogObject, emitToOtel } from './telemetry/pino_otel_transport.js';\n\n/** @internal */\nexport type LoggerOptions = {\n pretty: boolean;\n level?: string;\n};\n\n/** @internal */\nexport let loggerOptions: LoggerOptions;\n\n/** @internal */\nlet logger: Logger | undefined = undefined;\n\n/** @internal */\nlet otelEnabled = false;\n\n/** @internal */\nexport const log = () => {\n if (!logger) {\n throw new TypeError('logger not initialized. did you forget to run initializeLogger()?');\n }\n return logger;\n};\n\n/** @internal */\nexport const initializeLogger = ({ pretty, level }: LoggerOptions) => {\n loggerOptions = { pretty, level };\n logger = pino(\n { level: level || 'info' },\n pretty ? pinoPretty({ colorize: true }) : process.stdout,\n );\n};\n\n/**\n * Custom Pino destination that parses JSON logs and emits to OTEL.\n * This receives the FULL serialized log including msg, level, time, etc.\n */\nclass OtelDestination extends Writable {\n _write(chunk: Buffer, _encoding: string, callback: (error?: Error | null) => void): void {\n try {\n const line = chunk.toString().trim();\n if (line) {\n const logObj = JSON.parse(line) as PinoLogObject;\n emitToOtel(logObj);\n }\n } catch {\n // Ignore parse errors (e.g., non-JSON lines)\n }\n callback();\n }\n}\n\n/**\n * Enable OTEL logging by reconfiguring the logger with multistream.\n * Uses a custom destination that receives full JSON logs (with msg, level, time).\n *\n *
|
|
1
|
+
{"version":3,"sources":["../src/log.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Writable } from 'node:stream';\nimport type { DestinationStream, Logger } from 'pino';\nimport { multistream, pino } from 'pino';\nimport { build as pinoPretty } from 'pino-pretty';\nimport { type PinoLogObject, emitToOtel } from './telemetry/pino_otel_transport.js';\n\n/** @internal */\nexport type LoggerOptions = {\n pretty: boolean;\n level?: string;\n};\n\n/** @internal */\nexport let loggerOptions: LoggerOptions;\n\n/** @internal */\nlet logger: Logger | undefined = undefined;\n\n/** @internal */\nlet otelEnabled = false;\n\n/** @internal */\nexport const log = () => {\n if (!logger) {\n throw new TypeError('logger not initialized. did you forget to run initializeLogger()?');\n }\n return logger;\n};\n\n/** @internal */\nexport const initializeLogger = ({ pretty, level }: LoggerOptions) => {\n loggerOptions = { pretty, level };\n logger = pino(\n { level: level || 'info' },\n pretty ? pinoPretty({ colorize: true }) : process.stdout,\n );\n};\n\n/**\n * Custom Pino destination that parses JSON logs and emits to OTEL.\n * This receives the FULL serialized log including msg, level, time, etc.\n */\nclass OtelDestination extends Writable {\n _write(chunk: Buffer, _encoding: string, callback: (error?: Error | null) => void): void {\n try {\n const line = chunk.toString().trim();\n if (line) {\n const logObj = JSON.parse(line) as PinoLogObject;\n emitToOtel(logObj);\n }\n } catch {\n // Ignore parse errors (e.g., non-JSON lines)\n }\n callback();\n }\n}\n\n/**\n * Enable OTEL logging by reconfiguring the logger with multistream.\n * Uses a custom destination that receives full JSON logs (with msg, level, time).\n *\n * @internal\n */\nexport const enableOtelLogging = () => {\n if (otelEnabled || !logger) {\n console.warn('OTEL logging already enabled or logger not initialized');\n return;\n }\n otelEnabled = true;\n\n const { pretty, level } = loggerOptions;\n\n const logLevel = level || 'info';\n const streams: { stream: DestinationStream; level: string }[] = [\n { stream: pretty ? pinoPretty({ colorize: true }) : process.stdout, level: logLevel },\n { stream: new OtelDestination(), level: 'debug' },\n ];\n\n logger = pino({ level: logLevel }, multistream(streams));\n};\n"],"mappings":"AAGA,SAAS,gBAAgB;AAEzB,SAAS,aAAa,YAAY;AAClC,SAAS,SAAS,kBAAkB;AACpC,SAA6B,kBAAkB;AASxC,IAAI;AAGX,IAAI,SAA6B;AAGjC,IAAI,cAAc;AAGX,MAAM,MAAM,MAAM;AACvB,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,UAAU,mEAAmE;AAAA,EACzF;AACA,SAAO;AACT;AAGO,MAAM,mBAAmB,CAAC,EAAE,QAAQ,MAAM,MAAqB;AACpE,kBAAgB,EAAE,QAAQ,MAAM;AAChC,WAAS;AAAA,IACP,EAAE,OAAO,SAAS,OAAO;AAAA,IACzB,SAAS,WAAW,EAAE,UAAU,KAAK,CAAC,IAAI,QAAQ;AAAA,EACpD;AACF;AAMA,MAAM,wBAAwB,SAAS;AAAA,EACrC,OAAO,OAAe,WAAmB,UAAgD;AACvF,QAAI;AACF,YAAM,OAAO,MAAM,SAAS,EAAE,KAAK;AACnC,UAAI,MAAM;AACR,cAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,mBAAW,MAAM;AAAA,MACnB;AAAA,IACF,QAAQ;AAAA,IAER;AACA,aAAS;AAAA,EACX;AACF;AAQO,MAAM,oBAAoB,MAAM;AACrC,MAAI,eAAe,CAAC,QAAQ;AAC1B,YAAQ,KAAK,wDAAwD;AACrE;AAAA,EACF;AACA,gBAAc;AAEd,QAAM,EAAE,QAAQ,MAAM,IAAI;AAE1B,QAAM,WAAW,SAAS;AAC1B,QAAM,UAA0D;AAAA,IAC9D,EAAE,QAAQ,SAAS,WAAW,EAAE,UAAU,KAAK,CAAC,IAAI,QAAQ,QAAQ,OAAO,SAAS;AAAA,IACpF,EAAE,QAAQ,IAAI,gBAAgB,GAAG,OAAO,QAAQ;AAAA,EAClD;AAEA,WAAS,KAAK,EAAE,OAAO,SAAS,GAAG,YAAY,OAAO,CAAC;AACzD;","names":[]}
|
package/package.json
CHANGED
package/src/log.ts
CHANGED
|
@@ -62,11 +62,6 @@ class OtelDestination extends Writable {
|
|
|
62
62
|
* Enable OTEL logging by reconfiguring the logger with multistream.
|
|
63
63
|
* Uses a custom destination that receives full JSON logs (with msg, level, time).
|
|
64
64
|
*
|
|
65
|
-
* The base logger level is set to 'debug' so all logs are generated,
|
|
66
|
-
* while each stream filters to its own level:
|
|
67
|
-
* - Terminal: user-specified level (default: 'info')
|
|
68
|
-
* - OTEL/Cloud: always 'debug' to capture all logs for observability
|
|
69
|
-
*
|
|
70
65
|
* @internal
|
|
71
66
|
*/
|
|
72
67
|
export const enableOtelLogging = () => {
|
|
@@ -78,12 +73,11 @@ export const enableOtelLogging = () => {
|
|
|
78
73
|
|
|
79
74
|
const { pretty, level } = loggerOptions;
|
|
80
75
|
|
|
81
|
-
const
|
|
76
|
+
const logLevel = level || 'info';
|
|
82
77
|
const streams: { stream: DestinationStream; level: string }[] = [
|
|
83
|
-
{ stream: pretty ? pinoPretty({ colorize: true }) : process.stdout, level:
|
|
78
|
+
{ stream: pretty ? pinoPretty({ colorize: true }) : process.stdout, level: logLevel },
|
|
84
79
|
{ stream: new OtelDestination(), level: 'debug' },
|
|
85
80
|
];
|
|
86
81
|
|
|
87
|
-
|
|
88
|
-
logger = pino({ level: 'debug' }, multistream(streams));
|
|
82
|
+
logger = pino({ level: logLevel }, multistream(streams));
|
|
89
83
|
};
|