@holz/stream-backend 0.9.2-rc.60.sha-9c2a088 → 0.9.2-rc.62.sha-e65b918
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,19 +1,16 @@
|
|
|
1
|
-
import { LogProcessor } from
|
|
2
|
-
import { Writable } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare const createStreamBackend: ({ stream }: Config) => LogProcessor;
|
|
18
|
-
|
|
19
|
-
export { }
|
|
1
|
+
import { LogProcessor } from "@holz/core";
|
|
2
|
+
import { Writable } from "node:stream";
|
|
3
|
+
/**
|
|
4
|
+
* Prints logs to a writable stream in plaintext. Optimized for log files.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* createStreamBackend({
|
|
8
|
+
* stream: fs.createWriteStream('my-app.log', { flags: 'a' }),
|
|
9
|
+
* })
|
|
10
|
+
*/
|
|
11
|
+
export declare const createStreamBackend: ({ stream }: Config) => LogProcessor;
|
|
12
|
+
interface Config {
|
|
13
|
+
/** Where to print logs. Normally `process.stderr`. */
|
|
14
|
+
stream: Writable;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holz/stream-backend",
|
|
3
|
-
"version": "0.9.2-rc.
|
|
3
|
+
"version": "0.9.2-rc.62.sha-e65b918",
|
|
4
4
|
"description": "Print logs to stdout or a file.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"source": "./src/index.ts",
|
|
14
14
|
"types": "./dist/holz-stream-backend.d.ts",
|
|
15
|
-
"
|
|
16
|
-
"import": "./dist/holz-stream-backend.js"
|
|
15
|
+
"default": "./dist/holz-stream-backend.js"
|
|
17
16
|
}
|
|
18
17
|
},
|
|
19
18
|
"publishConfig": {
|
|
@@ -43,15 +42,13 @@
|
|
|
43
42
|
"@holz/core": "^0.8.0 || ^0.9.0"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@holz/core": "^0.9.2-rc.
|
|
47
|
-
"@microsoft/api-extractor": "^7.58.8",
|
|
45
|
+
"@holz/core": "^0.9.2-rc.62.sha-e65b918",
|
|
48
46
|
"@types/node": "^26.0.0",
|
|
49
47
|
"@vitest/coverage-v8": "^5.0.0",
|
|
48
|
+
"rolldown-plugin-dts": "^0.28.8",
|
|
50
49
|
"typescript": "^6.0.0",
|
|
51
50
|
"vite": "^8.0.0",
|
|
52
|
-
"vite-plugin-dts": "^5.0.0",
|
|
53
|
-
"vite-tsconfig-paths": "^6.0.0",
|
|
54
51
|
"vitest": "^5.0.0"
|
|
55
52
|
},
|
|
56
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e65b91827b38ec984286272eceb2d97296260ed1"
|
|
57
54
|
}
|
package/src/stream-backend.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { Writable } from 'node:stream';
|
|
2
2
|
import { EOL } from 'node:os';
|
|
3
3
|
import { inspect } from 'node:util';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
type LogLevel,
|
|
7
|
-
type Log,
|
|
8
|
-
type LogContext,
|
|
9
|
-
type LogProcessor,
|
|
10
|
-
} from '@holz/core';
|
|
4
|
+
import { level } from '@holz/core';
|
|
5
|
+
import type { LogLevel, Log, LogContext, LogProcessor } from '@holz/core';
|
|
11
6
|
|
|
12
7
|
/**
|
|
13
8
|
* Prints logs to a writable stream in plaintext. Optimized for log files.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("node:os"),t=require("node:util"),n=require("@holz/core");var r=({stream:n})=>r=>{let{error:s,...c}=r.context,l=new Date(r.timestamp).toISOString(),u=o[r.level],d=a(c),f=`${l} ${u} ${r.origin.length?`[${r.origin.join(`:`)}] `:``}`,p=`${f}${i(f.length,r.message)}${d?` `+d:``}`,m=s?(0,t.inspect)(s,{colors:!1})+e.EOL:``;n.write(`${p}${e.EOL}${m}`)},i=(e,t)=>t.replace(/(\r?\n)/g,t=>t+` `.repeat(e)),a=e=>Object.entries(e).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(` `),o={[n.level.trace]:`TRACE`,[n.level.debug]:`DEBUG`,[n.level.info]:`INFO `,[n.level.warn]:`WARN `,[n.level.error]:`ERROR`,[n.level.fatal]:`FATAL`};exports.createStreamBackend=r;
|