@ontrails/logtape 1.0.0-beta.39 → 1.0.0-beta.43
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 +10 -137
- package/README.md +26 -6
- package/package.json +11 -2
- package/src/index.ts +34 -43
package/CHANGELOG.md
CHANGED
|
@@ -1,142 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.0.0-beta.
|
|
3
|
+
## 1.0.0-beta.43
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Minor Changes
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- [`50e2779`](https://github.com/outfitter-dev/trails/commit/50e27796d074851bccd57d7df009db749757b457): Extract the real `@ontrails/logtape` and `@ontrails/pino` adapters from the
|
|
8
|
+
temporary observability subpaths. The new packages own their namesake foreign
|
|
9
|
+
dependencies and preserve Trails record metadata, levels, redaction boundaries,
|
|
10
|
+
and lifecycle behavior; the old subpaths are removed in the pre-v1 hard cut.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
Add governed Regrade transitions for both exact import replacements and expose
|
|
13
|
+
the observability adapter target through the shared adapter readiness check.
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## 1.0.0-beta.34
|
|
14
|
-
|
|
15
|
-
## 1.0.0-beta.33
|
|
16
|
-
|
|
17
|
-
## 1.0.0-beta.32
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- @ontrails/observe@1.0.0-beta.32
|
|
22
|
-
|
|
23
|
-
## 1.0.0-beta.31
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- @ontrails/observe@1.0.0-beta.31
|
|
28
|
-
|
|
29
|
-
## 1.0.0-beta.30
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
- @ontrails/observe@1.0.0-beta.30
|
|
34
|
-
|
|
35
|
-
## 1.0.0-beta.29
|
|
36
|
-
|
|
37
|
-
### Patch Changes
|
|
38
|
-
|
|
39
|
-
- @ontrails/observe@1.0.0-beta.29
|
|
40
|
-
|
|
41
|
-
## 1.0.0-beta.28
|
|
42
|
-
|
|
43
|
-
### Patch Changes
|
|
44
|
-
|
|
45
|
-
- @ontrails/observe@1.0.0-beta.28
|
|
46
|
-
|
|
47
|
-
## 1.0.0-beta.27
|
|
48
|
-
|
|
49
|
-
### Patch Changes
|
|
50
|
-
|
|
51
|
-
- @ontrails/observe@1.0.0-beta.27
|
|
52
|
-
|
|
53
|
-
## 1.0.0-beta.26
|
|
54
|
-
|
|
55
|
-
### Patch Changes
|
|
56
|
-
|
|
57
|
-
- @ontrails/observe@1.0.0-beta.26
|
|
58
|
-
|
|
59
|
-
## 1.0.0-beta.25
|
|
60
|
-
|
|
61
|
-
### Patch Changes
|
|
62
|
-
|
|
63
|
-
- @ontrails/observe@1.0.0-beta.25
|
|
64
|
-
|
|
65
|
-
## 1.0.0-beta.24
|
|
66
|
-
|
|
67
|
-
### Patch Changes
|
|
68
|
-
|
|
69
|
-
- @ontrails/observe@1.0.0-beta.24
|
|
70
|
-
|
|
71
|
-
## 1.0.0-beta.23
|
|
72
|
-
|
|
73
|
-
### Patch Changes
|
|
74
|
-
|
|
75
|
-
- @ontrails/observe@1.0.0-beta.23
|
|
76
|
-
|
|
77
|
-
## 1.0.0-beta.22
|
|
78
|
-
|
|
79
|
-
### Patch Changes
|
|
80
|
-
|
|
81
|
-
- @ontrails/observe@1.0.0-beta.22
|
|
82
|
-
|
|
83
|
-
## 1.0.0-beta.21
|
|
84
|
-
|
|
85
|
-
### Patch Changes
|
|
86
|
-
|
|
87
|
-
- @ontrails/observe@1.0.0-beta.21
|
|
88
|
-
|
|
89
|
-
## 1.0.0-beta.20
|
|
90
|
-
|
|
91
|
-
### Patch Changes
|
|
92
|
-
|
|
93
|
-
- @ontrails/observe@1.0.0-beta.20
|
|
94
|
-
|
|
95
|
-
## 1.0.0-beta.19
|
|
96
|
-
|
|
97
|
-
### Patch Changes
|
|
98
|
-
|
|
99
|
-
- Updated dependencies [1eb5bdc]
|
|
100
|
-
- @ontrails/observe@1.0.0-beta.19
|
|
101
|
-
|
|
102
|
-
## 1.0.0-beta.18
|
|
103
|
-
|
|
104
|
-
### Patch Changes
|
|
105
|
-
|
|
106
|
-
- Updated dependencies [bf44972]
|
|
107
|
-
- Updated dependencies [e0ae995]
|
|
108
|
-
- @ontrails/observe@1.0.0-beta.18
|
|
109
|
-
|
|
110
|
-
## 1.0.0-beta.17
|
|
111
|
-
|
|
112
|
-
### Patch Changes
|
|
113
|
-
|
|
114
|
-
- @ontrails/observe@1.0.0-beta.17
|
|
115
|
-
|
|
116
|
-
## 1.0.0-beta.16
|
|
117
|
-
|
|
118
|
-
### Major Changes
|
|
119
|
-
|
|
120
|
-
- 68f70fb: Retarget the LogTape adapter to `@ontrails/observe` log sink types and use `createLogtapeSink` as the canonical factory name.
|
|
121
|
-
Refresh the LogTape forwarding migration note for consumers moving off the retired logging package.
|
|
122
|
-
|
|
123
|
-
### Patch Changes
|
|
124
|
-
|
|
125
|
-
- 6300f70: Refresh source comments and test labels for retired connector terminology as adapter guardrails become strict.
|
|
126
|
-
- a8997ed: Add migration guidance for the retired `@ontrails/logging` package and align observability README examples around `@ontrails/observe`, `@ontrails/tracing`, and `@ontrails/logtape`.
|
|
127
|
-
- d40430d: Remove the retired `@ontrails/logging` workspace from the prerelease package set. Use `@ontrails/observe` for log and trace sink contracts and `@ontrails/logtape` for LogTape forwarding.
|
|
128
|
-
- Updated dependencies [6300f70]
|
|
129
|
-
- Updated dependencies [e898cc4]
|
|
130
|
-
- Updated dependencies [a8997ed]
|
|
131
|
-
- Updated dependencies [fe03945]
|
|
132
|
-
- Updated dependencies [d40430d]
|
|
133
|
-
- Updated dependencies [49c2e7d]
|
|
134
|
-
- Updated dependencies [9cdb0f2]
|
|
135
|
-
- Updated dependencies [22c6c06]
|
|
136
|
-
- @ontrails/observe@1.0.0-beta.16
|
|
137
|
-
|
|
138
|
-
## 1.0.0-beta.15
|
|
139
|
-
|
|
140
|
-
### Patch Changes
|
|
141
|
-
|
|
142
|
-
- @ontrails/observe@1.0.0-beta.15
|
|
15
|
+
All notable changes to this package are documented through the Trails release process.
|
package/README.md
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
# @ontrails/logtape
|
|
2
2
|
|
|
3
|
-
LogTape adapter for `@ontrails/
|
|
3
|
+
Real LogTape adapter for Trails observability. This extracted package owns the LogTape dependency boundary, keeping `@ontrails/observability` independent of foreign logging libraries.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
|
-
import {
|
|
8
|
+
import { configure, getConsoleSink } from '@logtape/logtape';
|
|
9
9
|
import { createLogtapeSink } from '@ontrails/logtape';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
await configure({
|
|
12
|
+
loggers: [{ category: 'app', lowestLevel: 'info', sinks: ['console'] }],
|
|
13
|
+
sinks: { console: getConsoleSink() },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const sink = createLogtapeSink();
|
|
17
|
+
sink.write({
|
|
18
|
+
category: 'app.http',
|
|
19
|
+
level: 'info',
|
|
20
|
+
message: 'request received',
|
|
21
|
+
metadata: { requestId: 'req_123' },
|
|
22
|
+
timestamp: new Date(),
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The application owns `configure()`; this library only resolves or accepts a configured LogTape logger. It forwards Trails records through LogTape's native `emit()` integration path, preserving the record timestamp, category, structured metadata, and the `warn` to `warning` level translation. Trails redaction occurs before the record reaches this adapter, and `silent` records do not reach LogTape.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
bun add @ontrails/observability@beta @ontrails/logtape@beta
|
|
12
32
|
```
|
|
13
33
|
|
|
14
|
-
|
|
34
|
+
## Migration
|
|
15
35
|
|
|
16
|
-
|
|
36
|
+
This package is the final LogTape adapter in the pre-v1 hard cut. No compatibility subpath remains; see the logging migration guide for the explicit historical import map.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontrails/logtape",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.43",
|
|
4
4
|
"files": [
|
|
5
5
|
"src/**/*.ts",
|
|
6
6
|
"!src/**/__tests__/**",
|
|
@@ -21,7 +21,16 @@
|
|
|
21
21
|
"lint": "oxlint ./src",
|
|
22
22
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
23
23
|
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@logtape/logtape": "^2.2.4"
|
|
26
|
+
},
|
|
24
27
|
"peerDependencies": {
|
|
25
|
-
"@ontrails/
|
|
28
|
+
"@ontrails/observability": "^1.0.0-beta.43",
|
|
29
|
+
"zod": "^4.3.5"
|
|
30
|
+
},
|
|
31
|
+
"trails": {
|
|
32
|
+
"adapter": {
|
|
33
|
+
"target": "observability"
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
36
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,68 +1,59 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { getLogger } from '@logtape/logtape';
|
|
2
|
+
import type { Logger } from '@logtape/logtape';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
// Minimal logtape logger interface (avoids importing @logtape/logtape)
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Subset of the logtape Logger interface that we forward records to.
|
|
9
|
-
* Accepts any object that provides the standard log-level methods.
|
|
10
|
-
*/
|
|
11
|
-
export interface LogtapeLoggerLike {
|
|
12
|
-
trace(message: string, props?: Record<string, unknown>): void;
|
|
13
|
-
debug(message: string, props?: Record<string, unknown>): void;
|
|
14
|
-
info(message: string, props?: Record<string, unknown>): void;
|
|
15
|
-
warn(message: string, props?: Record<string, unknown>): void;
|
|
16
|
-
error(message: string, props?: Record<string, unknown>): void;
|
|
17
|
-
fatal(message: string, props?: Record<string, unknown>): void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
// Options
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
4
|
+
import type { LogLevel, LogRecord, LogSink } from '@ontrails/observability';
|
|
23
5
|
|
|
24
6
|
export interface LogtapeSinkOptions {
|
|
25
|
-
/**
|
|
26
|
-
readonly logger
|
|
7
|
+
/** Existing configured LogTape logger. The application owns LogTape setup. */
|
|
8
|
+
readonly logger?: Logger | undefined;
|
|
9
|
+
/** Sink name exposed to Trails observe configuration. Defaults to `logtape`. */
|
|
10
|
+
readonly name?: string | undefined;
|
|
27
11
|
}
|
|
28
12
|
|
|
29
|
-
|
|
30
|
-
// createLogtapeSink
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
13
|
+
type ForwardMethod = 'trace' | 'debug' | 'info' | 'warning' | 'error' | 'fatal';
|
|
32
14
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const LEVEL_MAP: Record<string, ForwardMethod> = {
|
|
15
|
+
const LEVEL_MAP: Record<LogLevel, ForwardMethod | undefined> = {
|
|
36
16
|
debug: 'debug',
|
|
37
17
|
error: 'error',
|
|
38
18
|
fatal: 'fatal',
|
|
39
19
|
info: 'info',
|
|
20
|
+
silent: undefined,
|
|
40
21
|
trace: 'trace',
|
|
41
|
-
warn: '
|
|
22
|
+
warn: 'warning',
|
|
42
23
|
};
|
|
43
24
|
|
|
25
|
+
const buildProperties = (record: LogRecord): Record<string, unknown> => ({
|
|
26
|
+
...record.metadata,
|
|
27
|
+
category: record.category,
|
|
28
|
+
timestamp: record.timestamp.toISOString(),
|
|
29
|
+
});
|
|
30
|
+
|
|
44
31
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* data is scrubbed regardless of the backend.
|
|
32
|
+
* Create a Trails sink backed by LogTape. The adapter deliberately never calls
|
|
33
|
+
* `configure()`: libraries read the application-owned logger configuration.
|
|
48
34
|
*/
|
|
49
|
-
export const createLogtapeSink = (
|
|
50
|
-
|
|
35
|
+
export const createLogtapeSink = (
|
|
36
|
+
options: LogtapeSinkOptions = {}
|
|
37
|
+
): LogSink => {
|
|
38
|
+
const configuredLogger = options.logger;
|
|
51
39
|
|
|
52
40
|
return {
|
|
53
|
-
name: 'logtape',
|
|
41
|
+
name: options.name ?? 'logtape',
|
|
54
42
|
write(record: LogRecord): void {
|
|
55
43
|
const method = LEVEL_MAP[record.level];
|
|
56
44
|
if (method === undefined) {
|
|
57
45
|
return;
|
|
58
46
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
const logger =
|
|
48
|
+
configuredLogger ??
|
|
49
|
+
getLogger(record.category.split('.').filter(Boolean));
|
|
50
|
+
logger.emit({
|
|
51
|
+
level: method,
|
|
52
|
+
message: [record.message],
|
|
53
|
+
properties: buildProperties(record),
|
|
54
|
+
rawMessage: record.message,
|
|
55
|
+
timestamp: record.timestamp.getTime(),
|
|
56
|
+
});
|
|
66
57
|
},
|
|
67
58
|
};
|
|
68
59
|
};
|