@holz/json-backend 0.5.0 → 0.6.0

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.
Files changed (2) hide show
  1. package/README.md +21 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # `@holz/json-backend`
2
+
3
+ Prints structured logs to a writable stream in NDJSON form.
4
+
5
+ ## Usage
6
+
7
+ ```typescript
8
+ import { createJsonBackend } from '@holz/json-backend';
9
+ import { createLogger } from '@holz/core';
10
+ import * as fs from 'node:fs';
11
+
12
+ const logger = createLogger(
13
+ createJsonBackend({
14
+ stream: fs.createWriteStream('my-app.log', { flags: 'a' }),
15
+ })
16
+ );
17
+ ```
18
+
19
+ Logs are output in [NDJSON](http://ndjson.org/) format. The output is optimized for log files, following the order of typical log statements. The output includes the log level, timestamp, message, and context, if provided.
20
+
21
+ The `stream` option specifies where the logs will be written to. You can use any writable stream, such as a file or `process.stdout`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holz/json-backend",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Print logs as newline-delimited JSON.",
5
5
  "type": "module",
6
6
  "main": "./dist/holz-json-backend.cjs",
@@ -39,7 +39,7 @@
39
39
  "test:types": "tsc"
40
40
  },
41
41
  "devDependencies": {
42
- "@holz/core": "^0.5.0",
42
+ "@holz/core": "^0.6.0",
43
43
  "@types/node": "^18.14.0",
44
44
  "@vitest/coverage-c8": "^0.28.5",
45
45
  "typescript": "^4.9.5",