@holz/json-backend 0.8.0-rc.1 → 0.8.0-rc.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("node:os"),s={fatal:60,error:50,warn:40,info:30,debug:20,trace:10},c=({stream:t})=>e=>{const r=JSON.stringify({level:a[e.level],time:new Date().toISOString(),msg:e.message,ctx:Object.keys(e.context).length>0?e.context:void 0},o);t.write(`${r}${n.EOL}`)},o=(t,e)=>e instanceof Error?{...e,name:e.name,message:e.message,cause:e.cause}:e,a=Object.fromEntries(Object.entries(s).map(([t,e])=>[e,t]));exports.createJsonBackend=c;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("node:os"),s={fatal:60,error:50,warn:40,info:30,debug:20,trace:10},c=({stream:t})=>e=>{const r=JSON.stringify({level:a[e.level],time:new Date(e.timestamp).toISOString(),msg:e.message,ctx:Object.keys(e.context).length>0?e.context:void 0},o);t.write(`${r}${n.EOL}`)},o=(t,e)=>e instanceof Error?{...e,name:e.name,message:e.message,cause:e.cause}:e,a=Object.fromEntries(Object.entries(s).map(([t,e])=>[e,t]));exports.createJsonBackend=c;
|
|
@@ -12,11 +12,11 @@ const s = {
|
|
|
12
12
|
debug: 20,
|
|
13
13
|
/** Extremely detailed progress updates (usually hidden). */
|
|
14
14
|
trace: 10
|
|
15
|
-
},
|
|
15
|
+
}, i = ({ stream: t }) => (e) => {
|
|
16
16
|
const r = JSON.stringify(
|
|
17
17
|
{
|
|
18
18
|
level: o[e.level],
|
|
19
|
-
time:
|
|
19
|
+
time: new Date(e.timestamp).toISOString(),
|
|
20
20
|
msg: e.message,
|
|
21
21
|
ctx: Object.keys(e.context).length > 0 ? e.context : void 0
|
|
22
22
|
},
|
|
@@ -33,5 +33,5 @@ const s = {
|
|
|
33
33
|
Object.entries(s).map(([t, e]) => [e, t])
|
|
34
34
|
);
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
i as createJsonBackend
|
|
37
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holz/json-backend",
|
|
3
|
-
"version": "0.8.0-rc.
|
|
3
|
+
"version": "0.8.0-rc.2",
|
|
4
4
|
"description": "Print logs as newline-delimited JSON.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"test:types": "tsc"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@holz/core": "^0.8.0-rc.
|
|
40
|
+
"@holz/core": "^0.8.0-rc.2",
|
|
41
41
|
"@types/node": "^22.0.0",
|
|
42
42
|
"@vitest/coverage-v8": "^3.0.8",
|
|
43
43
|
"typescript": "^5.8.2",
|
package/src/json-backend.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const createJsonBackend = ({ stream }: Config): LogProcessor => {
|
|
|
20
20
|
const output = JSON.stringify(
|
|
21
21
|
{
|
|
22
22
|
level: labelForLevel[log.level],
|
|
23
|
-
time: new Date().toISOString(),
|
|
23
|
+
time: new Date(log.timestamp).toISOString(),
|
|
24
24
|
msg: log.message,
|
|
25
25
|
ctx: Object.keys(log.context).length > 0 ? log.context : undefined,
|
|
26
26
|
},
|