@ontrails/pino 1.0.0-beta.18 → 1.0.0-beta.19
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/CHANGELOG.md +8 -0
- package/README.md +6 -15
- package/package.json +2 -2
- package/src/index.ts +3 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -8,13 +8,11 @@ Pino adapter package for `@ontrails/observe`.
|
|
|
8
8
|
bun add @ontrails/observe @ontrails/pino pino
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
`pino` is supplied by your application. `@ontrails/pino` has no hard runtime
|
|
12
|
-
dependency on it.
|
|
11
|
+
`pino` is supplied by your application. `@ontrails/pino` has no hard runtime dependency on it.
|
|
13
12
|
|
|
14
13
|
## Usage
|
|
15
14
|
|
|
16
|
-
Use `createPinoSink(...)` when you already have a Pino-shaped logger and want
|
|
17
|
-
Trails log records to flow into it:
|
|
15
|
+
Use `createPinoSink(...)` when you already have a Pino-shaped logger and want Trails log records to flow into it:
|
|
18
16
|
|
|
19
17
|
```typescript
|
|
20
18
|
import pino from 'pino';
|
|
@@ -23,10 +21,7 @@ import { createPinoSink } from '@ontrails/pino';
|
|
|
23
21
|
const sink = createPinoSink(pino());
|
|
24
22
|
```
|
|
25
23
|
|
|
26
|
-
The package does not depend on `pino`; it accepts any object shaped like a Pino
|
|
27
|
-
logger through `PinoLoggerLike`. Records are forwarded in Pino's object-first
|
|
28
|
-
style as `logger.info(payload, message)`, preserving the metadata already
|
|
29
|
-
redacted by Trails.
|
|
24
|
+
The package does not depend on `pino`; it accepts any object shaped like a Pino logger through `PinoLoggerLike`. Records are forwarded in Pino's object-first style as `logger.info(payload, message)`, preserving the metadata already redacted by Trails.
|
|
30
25
|
|
|
31
26
|
```typescript
|
|
32
27
|
import pino from 'pino';
|
|
@@ -44,15 +39,13 @@ const graph = topo('app', trails, {
|
|
|
44
39
|
|
|
45
40
|
## Structural Logger Shape
|
|
46
41
|
|
|
47
|
-
`PinoLoggerLike` requires `trace`, `debug`, `info`, `warn`, `error`, and
|
|
48
|
-
`fatal` methods that accept `(payload, message)`. The sink forwards:
|
|
42
|
+
`PinoLoggerLike` requires `trace`, `debug`, `info`, `warn`, `error`, and `fatal` methods that accept `(payload, message)`. The sink forwards:
|
|
49
43
|
|
|
50
44
|
- `record.message` as the Pino message argument.
|
|
51
45
|
- `record.category`, `record.timestamp`, and `record.metadata` in the payload.
|
|
52
46
|
- `silent` records as no-ops.
|
|
53
47
|
|
|
54
|
-
If a required method is missing at runtime, the sink throws instead of silently
|
|
55
|
-
dropping the record.
|
|
48
|
+
If a required method is missing at runtime, the sink throws instead of silently dropping the record.
|
|
56
49
|
|
|
57
50
|
## Publishing
|
|
58
51
|
|
|
@@ -63,9 +56,7 @@ bun run publish:check
|
|
|
63
56
|
bun run publish:registry-check
|
|
64
57
|
```
|
|
65
58
|
|
|
66
|
-
`publish:registry-check` is read-only. Before the first registry publication it
|
|
67
|
-
may report `@ontrails/pino` as a first-time package candidate. Actual package
|
|
68
|
-
publication still goes through the repo script:
|
|
59
|
+
`publish:registry-check` is read-only. Before the first registry publication it may report `@ontrails/pino` as a first-time package candidate. Actual package publication still goes through the repo script:
|
|
69
60
|
|
|
70
61
|
```bash
|
|
71
62
|
bun run publish:packages
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontrails/pino",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.19",
|
|
4
4
|
"files": [
|
|
5
5
|
"src/**/*.ts",
|
|
6
6
|
"!src/**/__tests__/**",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@ontrails/observe": "^1.0.0-beta.
|
|
25
|
+
"@ontrails/observe": "^1.0.0-beta.19"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,9 @@ import type { LogLevel, LogRecord, LogSink } from '@ontrails/observe';
|
|
|
5
5
|
*/
|
|
6
6
|
export const pinoPackageName = '@ontrails/pino';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Signature for a Pino-compatible logger method used when forwarding Trails records.
|
|
10
|
+
*/
|
|
8
11
|
export type PinoLogMethod = (
|
|
9
12
|
payload: Record<string, unknown>,
|
|
10
13
|
message?: string
|