@nwire/logger 0.7.0 → 0.7.1
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/README.md +0 -23
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -12,24 +12,6 @@ A tiny `Logger` interface (`debug` / `info` / `warn` / `error` + `child(bindings
|
|
|
12
12
|
pnpm add @nwire/logger
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## Standalone use
|
|
16
|
-
|
|
17
|
-
For developers building a library that wants a structured-logging contract without forcing pino/winston on consumers. Code logs against `Logger`; callers inject whichever adapter they want.
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { ConsoleLogger, type Logger } from "@nwire/logger";
|
|
21
|
-
|
|
22
|
-
class CourseService {
|
|
23
|
-
constructor(private log: Logger) {}
|
|
24
|
-
async enrol(studentId: string, courseId: string) {
|
|
25
|
-
this.log.info({ studentId, courseId }, "enrolling");
|
|
26
|
-
// …
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const svc = new CourseService(new ConsoleLogger({ level: "info" }));
|
|
31
|
-
```
|
|
32
|
-
|
|
33
15
|
## Within nwire-app
|
|
34
16
|
|
|
35
17
|
For developers using this package as part of the Nwire stack. `ctx.logger` is already attached per request with envelope ids (`correlationId`, `causationId`, `tenant`, `userId`) bound. Touch this package directly only when implementing a custom adapter.
|
|
@@ -51,8 +33,3 @@ log.info({ courseId: "c-1" }, "course requested");
|
|
|
51
33
|
- `NoopLogger` — silent default; use in tests.
|
|
52
34
|
- `ConsoleLogger` — JSON-line stdout; use in dev.
|
|
53
35
|
- `loggerForEnvelope(parent, envelope)` — derives a child logger with envelope ids pre-bound.
|
|
54
|
-
|
|
55
|
-
## See also
|
|
56
|
-
|
|
57
|
-
- [Architecture sketch §05 — Foundation tier](../../architecture-sketch.html#packages)
|
|
58
|
-
- Sibling packages: [@nwire/logger-pino](../nwire-logger-pino), [@nwire/envelope](../nwire-envelope)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/logger",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Nwire — Logger contract + Noop + Console defaults. Production adapters: @nwire/logger-pino, @nwire/logger-winston. Envelope ids auto-attached via loggerForEnvelope.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"log",
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
"nwire",
|
|
9
9
|
"observability"
|
|
10
10
|
],
|
|
11
|
+
"license": "MIT",
|
|
11
12
|
"files": [
|
|
12
13
|
"dist",
|
|
13
|
-
"README.md"
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
14
16
|
],
|
|
15
17
|
"type": "module",
|
|
16
18
|
"main": "./dist/logger-iface.js",
|
|
@@ -25,7 +27,7 @@
|
|
|
25
27
|
"access": "public"
|
|
26
28
|
},
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"@nwire/envelope": "0.7.
|
|
30
|
+
"@nwire/envelope": "0.7.1"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"@types/node": "^22.19.9",
|