@holz/stream-backend 0.6.0 → 0.7.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.
@@ -0,0 +1,19 @@
1
+ import { LogProcessor } from '@holz/core';
2
+ import { Writable } from 'node:stream';
3
+
4
+ declare interface Config {
5
+ /** Where to print logs. Normally `process.stderr`. */
6
+ stream: Writable;
7
+ }
8
+
9
+ /**
10
+ * Prints logs to a writable stream in plaintext. Optimized for log files.
11
+ *
12
+ * @example
13
+ * createStreamBackend({
14
+ * stream: fs.createWriteStream('my-app.log', { flags: 'a' }),
15
+ * })
16
+ */
17
+ export declare function createStreamBackend({ stream }: Config): LogProcessor;
18
+
19
+ export { }
@@ -2,7 +2,7 @@ import { EOL as u } from "node:os";
2
2
  import { LogLevel as r } from "@holz/core";
3
3
  function l({ stream: t }) {
4
4
  return (e) => {
5
- const n = new Date().toISOString(), c = g[e.level], o = f(e.context), s = e.origin.length ? `[${e.origin.join(":")}] ` : "", i = `${n} ${c} ${s}`, a = $(i.length, e.message), m = `${i}${a}${o ? " " + o : ""}`;
5
+ const n = (/* @__PURE__ */ new Date()).toISOString(), c = g[e.level], o = f(e.context), s = e.origin.length ? `[${e.origin.join(":")}] ` : "", i = `${n} ${c} ${s}`, a = $(i.length, e.message), m = `${i}${a}${o ? " " + o : ""}`;
6
6
  t.write(`${m}${u}`);
7
7
  };
8
8
  }
package/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "@holz/stream-backend",
3
- "version": "0.6.0",
3
+ "version": "0.7.0-rc.2",
4
4
  "description": "Print logs to stdout or a file.",
5
5
  "type": "module",
6
- "main": "./dist/holz-stream-backend.cjs",
7
- "module": "./dist/holz-stream-backend.js",
8
- "types": "./src/index.ts",
9
6
  "repository": {
10
7
  "type": "git",
11
8
  "url": "https://github.com/PsychoLlama/holz",
@@ -13,6 +10,7 @@
13
10
  },
14
11
  "exports": {
15
12
  ".": {
13
+ "types": "./dist/holz-stream-backend.d.ts",
16
14
  "require": "./dist/holz-stream-backend.cjs",
17
15
  "import": "./dist/holz-stream-backend.js"
18
16
  }
@@ -39,14 +37,17 @@
39
37
  "test:types": "tsc"
40
38
  },
41
39
  "peerDependencies": {
42
- "@holz/core": "^0.6.0"
40
+ "@holz/core": "^0.7.0-rc.2"
43
41
  },
44
42
  "devDependencies": {
45
- "@holz/core": "^0.6.0",
46
- "@types/node": "^18.14.0",
47
- "@vitest/coverage-c8": "^0.28.5",
48
- "typescript": "^4.9.5",
49
- "vite": "^4.0.0",
50
- "vitest": "^0.28.5"
51
- }
43
+ "@holz/core": "^0.7.0-rc.2",
44
+ "@types/node": "^22.0.0",
45
+ "@vitest/coverage-v8": "^3.0.8",
46
+ "typescript": "^5.0.0",
47
+ "vite": "^6.0.0",
48
+ "vite-plugin-dts": "^4.5.3",
49
+ "vite-tsconfig-paths": "^5.1.4",
50
+ "vitest": "^3.0.8"
51
+ },
52
+ "stableVersion": "0.6.0"
52
53
  }