@holz/json-backend 0.9.2-rc.61.sha-3eaf26e → 0.9.2-rc.63.sha-dee6a77
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/holz-json-backend.d.ts +19 -22
- package/dist/marshal.d.ts +16 -20
- package/package.json +6 -9
- package/src/marshal/marshal.ts +2 -1
- package/dist/holz-json-backend.cjs +0 -1
- package/dist/marshal-Dq-F5gZZ.cjs +0 -1
- package/dist/marshal.cjs +0 -1
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { LogProcessor } from
|
|
2
|
-
import { Writable } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export declare const createJsonBackend: ({ stream }: Config) => LogProcessor;
|
|
21
|
-
|
|
22
|
-
export { }
|
|
1
|
+
import { LogProcessor } from "@holz/core";
|
|
2
|
+
import { Writable } from "node:stream";
|
|
3
|
+
/**
|
|
4
|
+
* Prints structured logs to a writable stream in NDJSON form. Optimized for
|
|
5
|
+
* log files.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* createJsonBackend({
|
|
9
|
+
* stream: fs.createWriteStream('my-app.log', { flags: 'a' }),
|
|
10
|
+
* })
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/ndjson/ndjson-spec
|
|
13
|
+
*/
|
|
14
|
+
export declare const createJsonBackend: ({ stream }: Config) => LogProcessor;
|
|
15
|
+
interface Config {
|
|
16
|
+
/** Where to print logs. */
|
|
17
|
+
stream: Writable;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
package/dist/marshal.d.ts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { Log } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
export declare const toJSON: (log: Log) => Record<string, unknown>;
|
|
19
|
-
|
|
20
|
-
export { }
|
|
1
|
+
import { Log } from "@holz/core";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a log to a JSON-serializable object.
|
|
4
|
+
* Keys ordered to make visually skimming a log file easier.
|
|
5
|
+
*/
|
|
6
|
+
export declare const toJSON: (log: Log) => Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Best-effort attempt at converting `Error` instances to serializable JSON.
|
|
9
|
+
*
|
|
10
|
+
* These are among the most important logs, but the default behavior produces
|
|
11
|
+
* an empty object.
|
|
12
|
+
*
|
|
13
|
+
* This is NOT a lossless conversion. Values are too dynamic, especially
|
|
14
|
+
* considering custom errors. But it should handle the vast majority.
|
|
15
|
+
*/
|
|
16
|
+
export declare const errorToJSON: (error: Error) => Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holz/json-backend",
|
|
3
|
-
"version": "0.9.2-rc.
|
|
3
|
+
"version": "0.9.2-rc.63.sha-dee6a77",
|
|
4
4
|
"description": "Print logs as newline-delimited JSON.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -12,14 +12,12 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"source": "./src/index.ts",
|
|
14
14
|
"types": "./dist/holz-json-backend.d.ts",
|
|
15
|
-
"
|
|
16
|
-
"import": "./dist/holz-json-backend.js"
|
|
15
|
+
"default": "./dist/holz-json-backend.js"
|
|
17
16
|
},
|
|
18
17
|
"./marshal": {
|
|
19
18
|
"source": "./src/marshal/index.ts",
|
|
20
19
|
"types": "./dist/marshal.d.ts",
|
|
21
|
-
"
|
|
22
|
-
"import": "./dist/marshal.js"
|
|
20
|
+
"default": "./dist/marshal.js"
|
|
23
21
|
}
|
|
24
22
|
},
|
|
25
23
|
"publishConfig": {
|
|
@@ -49,14 +47,13 @@
|
|
|
49
47
|
"@holz/core": "^0.9.0"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
|
-
"@holz/core": "^0.9.2-rc.
|
|
53
|
-
"@microsoft/api-extractor": "^7.58.8",
|
|
50
|
+
"@holz/core": "^0.9.2-rc.63.sha-dee6a77",
|
|
54
51
|
"@types/node": "^26.0.0",
|
|
55
52
|
"@vitest/coverage-v8": "^5.0.0",
|
|
53
|
+
"rolldown-plugin-dts": "^0.28.8",
|
|
56
54
|
"typescript": "^6.0.0",
|
|
57
|
-
"unplugin-dts": "^1.1.2",
|
|
58
55
|
"vite": "^8.0.0",
|
|
59
56
|
"vitest": "^5.0.0"
|
|
60
57
|
},
|
|
61
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "dee6a77575b5f7d02d2f29e01a81da4a4aed8e91"
|
|
62
59
|
}
|
package/src/marshal/marshal.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./marshal-Dq-F5gZZ.cjs");var t=({stream:t})=>n=>{t.write(`${JSON.stringify(e.n(n))}\n`)};exports.createJsonBackend=t;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("@holz/core");var t=e=>({level:a[e.level],timestamp:new Date(e.timestamp).toISOString(),message:e.message,origin:e.origin,context:i(e.context)}),n=e=>({...e,name:e.name,message:e.message,cause:r(e.cause),errors:r(e.errors),stack:e.stack}),r=e=>e instanceof Error?n(e):Array.isArray(e)?e.map(r):e,i=e=>({...e,error:r(e.error)}),a=Object.fromEntries(Object.entries(e.level).map(([e,t])=>[t,e]));Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
package/dist/marshal.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./marshal-Dq-F5gZZ.cjs");exports.errorToJSON=e.t,exports.toJSON=e.n;
|