@orpc/experimental-pino 1.11.0 → 1.11.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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ declare const CONTEXT_LOGGER_SYMBOL: unique symbol;
|
|
|
6
6
|
interface LoggerContext {
|
|
7
7
|
[CONTEXT_LOGGER_SYMBOL]?: Logger;
|
|
8
8
|
}
|
|
9
|
-
declare function getLogger(context:
|
|
9
|
+
declare function getLogger(context: LoggerContext): Logger | undefined;
|
|
10
10
|
|
|
11
11
|
interface LoggingHandlerPluginOptions<T extends Context> {
|
|
12
12
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare const CONTEXT_LOGGER_SYMBOL: unique symbol;
|
|
|
6
6
|
interface LoggerContext {
|
|
7
7
|
[CONTEXT_LOGGER_SYMBOL]?: Logger;
|
|
8
8
|
}
|
|
9
|
-
declare function getLogger(context:
|
|
9
|
+
declare function getLogger(context: LoggerContext): Logger | undefined;
|
|
10
10
|
|
|
11
11
|
interface LoggingHandlerPluginOptions<T extends Context> {
|
|
12
12
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { get, isAsyncIteratorObject, overlayProxy } from '@orpc/shared';
|
|
2
1
|
import { mapEventIterator } from '@orpc/client';
|
|
2
|
+
import { ORPC_NAME, isAsyncIteratorObject, overlayProxy } from '@orpc/shared';
|
|
3
3
|
import pino from 'pino';
|
|
4
4
|
|
|
5
5
|
const CONTEXT_LOGGER_SYMBOL = Symbol("ORPC_PINO_CONTEXT_LOGGER_SYMBOL");
|
|
6
6
|
function getLogger(context) {
|
|
7
|
-
return
|
|
7
|
+
return context[CONTEXT_LOGGER_SYMBOL];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
class LoggingHandlerPlugin {
|
|
@@ -24,7 +24,7 @@ class LoggingHandlerPlugin {
|
|
|
24
24
|
options.clientInterceptors ??= [];
|
|
25
25
|
options.rootInterceptors.unshift(async (interceptorOptions) => {
|
|
26
26
|
const logger = (interceptorOptions.context[CONTEXT_LOGGER_SYMBOL] ?? this.logger).child({
|
|
27
|
-
|
|
27
|
+
rpc: { id: this.generateId(interceptorOptions), system: ORPC_NAME }
|
|
28
28
|
});
|
|
29
29
|
if (!logger.bindings().req) {
|
|
30
30
|
logger.setBindings({
|
|
@@ -93,7 +93,7 @@ class LoggingHandlerPlugin {
|
|
|
93
93
|
});
|
|
94
94
|
options.clientInterceptors.unshift(async ({ next, path, context, signal }) => {
|
|
95
95
|
const logger = getLogger(context);
|
|
96
|
-
logger?.setBindings({
|
|
96
|
+
logger?.setBindings({ rpc: { ...logger.bindings().rpc, method: path.join(".") } });
|
|
97
97
|
const output = await next();
|
|
98
98
|
if (isAsyncIteratorObject(output)) {
|
|
99
99
|
return overlayProxy(output, mapEventIterator(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/experimental-pino",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"pino": ">=10.1.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@orpc/
|
|
31
|
-
"@orpc/
|
|
32
|
-
"@orpc/shared": "1.11.
|
|
30
|
+
"@orpc/server": "1.11.2",
|
|
31
|
+
"@orpc/client": "1.11.2",
|
|
32
|
+
"@orpc/shared": "1.11.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"pino": "^10.1.0"
|