@c9up/spectrum 0.1.18 → 0.1.20
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/README.md +33 -7
- package/dist/Logger.d.ts +6 -2
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +214 -80
- package/dist/Logger.js.map +1 -1
- package/dist/LoggerManager.d.ts +5 -0
- package/dist/LoggerManager.d.ts.map +1 -1
- package/dist/LoggerManager.js +10 -3
- package/dist/LoggerManager.js.map +1 -1
- package/dist/RustLogBridge.d.ts +27 -2
- package/dist/RustLogBridge.d.ts.map +1 -1
- package/dist/RustLogBridge.js +45 -31
- package/dist/RustLogBridge.js.map +1 -1
- package/dist/SpectrumProvider.d.ts +6 -2
- package/dist/SpectrumProvider.d.ts.map +1 -1
- package/dist/SpectrumProvider.js +18 -12
- package/dist/SpectrumProvider.js.map +1 -1
- package/dist/channels/ConsoleChannel.d.ts +8 -1
- package/dist/channels/ConsoleChannel.d.ts.map +1 -1
- package/dist/channels/ConsoleChannel.js +18 -14
- package/dist/channels/ConsoleChannel.js.map +1 -1
- package/dist/channels/FileChannel.d.ts +32 -9
- package/dist/channels/FileChannel.d.ts.map +1 -1
- package/dist/channels/FileChannel.js +264 -202
- package/dist/channels/FileChannel.js.map +1 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonLine.d.ts +49 -0
- package/dist/jsonLine.d.ts.map +1 -0
- package/dist/jsonLine.js +165 -0
- package/dist/jsonLine.js.map +1 -0
- package/dist/redact.d.ts +16 -3
- package/dist/redact.d.ts.map +1 -1
- package/dist/redact.js +121 -10
- package/dist/redact.js.map +1 -1
- package/dist/sanitize.d.ts +11 -5
- package/dist/sanitize.d.ts.map +1 -1
- package/dist/sanitize.js +36 -12
- package/dist/sanitize.js.map +1 -1
- package/dist/services/main.d.ts.map +1 -1
- package/dist/services/main.js +12 -1
- package/dist/services/main.js.map +1 -1
- package/dist/stdSerializers.d.ts +48 -0
- package/dist/stdSerializers.d.ts.map +1 -0
- package/dist/stdSerializers.js +129 -0
- package/dist/stdSerializers.js.map +1 -0
- package/dist/stringify.d.ts +33 -0
- package/dist/stringify.d.ts.map +1 -0
- package/dist/stringify.js +148 -0
- package/dist/stringify.js.map +1 -0
- package/dist/targets.d.ts +29 -7
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +130 -31
- package/dist/targets.js.map +1 -1
- package/dist/testing/FakeLogger.js +20 -5
- package/dist/testing/FakeLogger.js.map +1 -1
- package/dist/types.d.ts +71 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +21 -3
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/Logger.ts +277 -85
- package/src/LoggerManager.ts +10 -3
- package/src/RustLogBridge.ts +59 -30
- package/src/SpectrumProvider.ts +31 -18
- package/src/channels/ConsoleChannel.ts +30 -14
- package/src/channels/FileChannel.ts +319 -220
- package/src/errors.ts +13 -0
- package/src/index.ts +17 -3
- package/src/jsonLine.ts +223 -0
- package/src/redact.ts +133 -9
- package/src/sanitize.ts +36 -12
- package/src/services/main.ts +13 -1
- package/src/stdSerializers.ts +147 -0
- package/src/stringify.ts +175 -0
- package/src/targets.ts +193 -42
- package/src/testing/FakeLogger.ts +23 -5
- package/src/types.ts +100 -5
- package/stubs/config/logger.stub +11 -1
|
@@ -1,272 +1,334 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File logging channel — writes log entries to a file as JSON lines.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* HTTP hot path
|
|
4
|
+
* `write()` never touches the disk: it queues the line and returns. One
|
|
5
|
+
* asynchronous pump opens the file, writes the queue in order, and rotates it
|
|
6
|
+
* when the next line would cross `maxSizeBytes`, so the HTTP hot path never
|
|
7
|
+
* waits on the filesystem.
|
|
8
|
+
*
|
|
9
|
+
* Two promises hold that together, both as pino's file destination keeps them:
|
|
10
|
+
* a line accepted before the process exits is on disk after it (the queue is
|
|
11
|
+
* written synchronously on `exit`), and a destination that stops keeping up
|
|
12
|
+
* costs bounded memory (past `maxBufferBytes` lines are dropped and counted,
|
|
13
|
+
* and the count is written once the queue drains).
|
|
7
14
|
*
|
|
8
15
|
* @implements MISS-14, MISS-15
|
|
9
16
|
*/
|
|
17
|
+
var _a;
|
|
10
18
|
import * as fs from "node:fs";
|
|
11
19
|
import * as fsp from "node:fs/promises";
|
|
12
20
|
import * as path from "node:path";
|
|
21
|
+
import { promisify } from "node:util";
|
|
22
|
+
import { SpectrumError } from "../errors.js";
|
|
23
|
+
import { jsonLine } from "../jsonLine.js";
|
|
24
|
+
const openFd = promisify(fs.open);
|
|
25
|
+
const writeFd = promisify(fs.write);
|
|
26
|
+
const closeFd = promisify(fs.close);
|
|
27
|
+
const fstatFd = promisify(fs.fstat);
|
|
28
|
+
/** How much of the queue goes to the kernel in one write. */
|
|
29
|
+
const CHUNK_BYTES = 64 * 1024;
|
|
30
|
+
function positiveInteger(name, value, fallback) {
|
|
31
|
+
if (value === undefined)
|
|
32
|
+
return fallback;
|
|
33
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
34
|
+
throw new SpectrumError("E_SPECTRUM_INVALID_FILE_OPTIONS", `FileChannel ${name} must be a positive integer, got ${String(value)}`);
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
13
38
|
export class FileChannel {
|
|
14
39
|
name = "file";
|
|
15
40
|
#filePath;
|
|
41
|
+
/** Whether `#fd` was handed in rather than opened here. */
|
|
42
|
+
#fdGiven;
|
|
43
|
+
/** Truncate on the next open: `append: false`, until the first open. */
|
|
44
|
+
#truncate;
|
|
16
45
|
#maxSize;
|
|
17
46
|
#maxFiles;
|
|
18
|
-
#
|
|
47
|
+
#maxBuffer;
|
|
48
|
+
#fd = null;
|
|
49
|
+
/** Bytes in the live file, as far as this channel has written them. */
|
|
19
50
|
#currentSize = 0;
|
|
20
|
-
|
|
21
|
-
#
|
|
51
|
+
/** Lines accepted and not yet handed to the kernel. */
|
|
52
|
+
#queue = [];
|
|
53
|
+
/** Bytes of the queue plus the chunk being written. */
|
|
54
|
+
#pendingBytes = 0;
|
|
55
|
+
/** Lines refused since the last notice, because the queue was full. */
|
|
56
|
+
#dropped = 0;
|
|
57
|
+
/** The running pump, so there is only ever one and close() can wait for it. */
|
|
58
|
+
#pump = null;
|
|
59
|
+
/** A rotation that failed lets the next chunk through rather than retrying forever. */
|
|
60
|
+
#skipRotation = false;
|
|
22
61
|
/**
|
|
23
|
-
* Terminal once `close()` has run
|
|
24
|
-
*
|
|
25
|
-
* Nulling the stream was not enough: `write()` reopens a null stream, and so
|
|
26
|
-
* does a rotation, so a line written after close silently reopened the file
|
|
27
|
-
* and appended to it. A closed channel stays closed.
|
|
62
|
+
* Terminal once `close()` has run: a line written after close is refused,
|
|
63
|
+
* and nothing reopens the file.
|
|
28
64
|
*/
|
|
29
65
|
#closed = false;
|
|
30
|
-
#
|
|
66
|
+
#closing;
|
|
67
|
+
#ref = new WeakRef(this);
|
|
31
68
|
constructor(config) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
69
|
+
const { path: filePath, fd } = config;
|
|
70
|
+
if ((filePath === undefined) === (fd === undefined)) {
|
|
71
|
+
throw new SpectrumError("E_SPECTRUM_INVALID_FILE_OPTIONS", "FileChannel needs exactly one of `path` and `fd`");
|
|
72
|
+
}
|
|
73
|
+
if (fd !== undefined && !(Number.isInteger(fd) && fd >= 0)) {
|
|
74
|
+
throw new SpectrumError("E_SPECTRUM_INVALID_FILE_OPTIONS", `FileChannel fd must be a non-negative integer, got ${String(fd)}`);
|
|
75
|
+
}
|
|
76
|
+
this.#filePath = filePath ?? `fd ${String(fd)}`;
|
|
77
|
+
this.#fdGiven = fd !== undefined;
|
|
78
|
+
this.#truncate = config.append === false;
|
|
79
|
+
if (fd !== undefined)
|
|
80
|
+
this.#fd = fd;
|
|
81
|
+
// Checked here, not trusted: -1 rotated on every line and deleted the
|
|
82
|
+
// log, and NaN (an unset env var through Number()) never rotated at all.
|
|
83
|
+
this.#maxSize = positiveInteger("maxSizeBytes", config.maxSizeBytes, 10 * 1024 * 1024);
|
|
84
|
+
this.#maxFiles = positiveInteger("maxFiles", config.maxFiles, 5);
|
|
85
|
+
this.#maxBuffer = positiveInteger("maxBufferBytes", config.maxBufferBytes, 16 * 1024 * 1024);
|
|
35
86
|
}
|
|
36
87
|
write(entry) {
|
|
37
88
|
if (this.#closed)
|
|
38
89
|
return;
|
|
39
|
-
const line = `${
|
|
90
|
+
const line = `${jsonLine(entry)}\n`;
|
|
40
91
|
const bytes = Buffer.byteLength(line, "utf8");
|
|
41
|
-
if (this.#
|
|
42
|
-
this.#
|
|
92
|
+
if (this.#pendingBytes + bytes > this.#maxBuffer) {
|
|
93
|
+
this.#dropped += 1;
|
|
43
94
|
return;
|
|
44
95
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
96
|
+
this.#queue.push({ line, bytes });
|
|
97
|
+
this.#pendingBytes += bytes;
|
|
98
|
+
_a.#track(this.#ref);
|
|
99
|
+
this.#kick();
|
|
100
|
+
}
|
|
101
|
+
#kick() {
|
|
102
|
+
if (this.#pump !== null)
|
|
103
|
+
return;
|
|
104
|
+
this.#pump = this.#drain().finally(() => {
|
|
105
|
+
this.#pump = null;
|
|
106
|
+
// A line queued between the loop's last check and here.
|
|
107
|
+
if (this.#queue.length > 0 || this.#dropped > 0)
|
|
108
|
+
this.#kick();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
async #drain() {
|
|
112
|
+
for (;;) {
|
|
113
|
+
if (this.#queue.length === 0) {
|
|
114
|
+
if (this.#dropped === 0)
|
|
115
|
+
return;
|
|
116
|
+
this.#enqueueDropNotice();
|
|
48
117
|
}
|
|
49
|
-
|
|
50
|
-
|
|
118
|
+
if (this.#fd === null && !(await this.#open())) {
|
|
119
|
+
this.#discardQueue("could not be opened");
|
|
51
120
|
return;
|
|
52
121
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// fire. #flushPending may itself trigger a rotation if a buffered
|
|
58
|
-
// line overflows, so re-check before writing the current line.
|
|
59
|
-
this.#flushPending();
|
|
60
|
-
if (this.#rotating) {
|
|
61
|
-
this.#pending.push(line);
|
|
62
|
-
return;
|
|
122
|
+
const chunk = this.#takeChunk();
|
|
123
|
+
if (chunk === null) {
|
|
124
|
+
await this.#rotate();
|
|
125
|
+
continue;
|
|
63
126
|
}
|
|
64
|
-
|
|
65
|
-
if (this.#needsRotation(bytes)) {
|
|
66
|
-
this.#pending.push(line);
|
|
67
|
-
this.#scheduleRotation();
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (this.#stream) {
|
|
71
|
-
this.#stream.write(line);
|
|
72
|
-
this.#currentSize += bytes;
|
|
127
|
+
await this.#writeChunk(chunk.text, chunk.bytes);
|
|
73
128
|
}
|
|
74
129
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Lines from the head of the queue that fit in the live file, up to
|
|
132
|
+
* {@link CHUNK_BYTES}; `null` when the head line needs a rotation first.
|
|
133
|
+
*
|
|
134
|
+
* An empty file takes its first line whatever its size: a line cannot be
|
|
135
|
+
* split, and one bigger than `maxSizeBytes` would otherwise rotate forever
|
|
136
|
+
* without ever being written.
|
|
137
|
+
*/
|
|
138
|
+
#takeChunk() {
|
|
139
|
+
let text = "";
|
|
140
|
+
let bytes = 0;
|
|
141
|
+
while (this.#queue.length > 0) {
|
|
142
|
+
const head = this.#queue[0];
|
|
143
|
+
if (head === undefined)
|
|
144
|
+
break;
|
|
145
|
+
const size = this.#currentSize + bytes;
|
|
146
|
+
const overflows = !this.#fdGiven && size > 0 && size + head.bytes > this.#maxSize;
|
|
147
|
+
if (overflows && !this.#skipRotation)
|
|
148
|
+
break;
|
|
149
|
+
if (bytes > 0 && bytes + head.bytes > CHUNK_BYTES)
|
|
150
|
+
break;
|
|
151
|
+
this.#queue.shift();
|
|
152
|
+
text += head.line;
|
|
153
|
+
bytes += head.bytes;
|
|
154
|
+
this.#skipRotation = false;
|
|
85
155
|
}
|
|
156
|
+
return bytes === 0 ? null : { text, bytes };
|
|
157
|
+
}
|
|
158
|
+
async #open() {
|
|
86
159
|
try {
|
|
87
|
-
|
|
160
|
+
await fsp.mkdir(path.dirname(this.#filePath), { recursive: true });
|
|
161
|
+
const fd = await openFd(this.#filePath, this.#truncate ? "w" : "a");
|
|
162
|
+
this.#truncate = false;
|
|
163
|
+
try {
|
|
164
|
+
this.#currentSize = (await fstatFd(fd)).size;
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
this.#currentSize = 0;
|
|
168
|
+
}
|
|
169
|
+
this.#fd = fd;
|
|
170
|
+
return true;
|
|
88
171
|
}
|
|
89
172
|
catch {
|
|
90
|
-
|
|
173
|
+
return false;
|
|
91
174
|
}
|
|
92
|
-
this.#stream = fs.createWriteStream(this.#filePath, { flags: "a" });
|
|
93
|
-
this.#stream.on("error", (err) => {
|
|
94
|
-
process.stderr.write(`[Spectrum] FileChannel stream error: ${err.message}\n`);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Whether this line has to wait for a rotation.
|
|
99
|
-
*
|
|
100
|
-
* The empty-file test is what stops an entry LARGER than `maxSizeBytes`
|
|
101
|
-
* from spinning forever: a fresh file starts at zero, so `0 + bytes > max`
|
|
102
|
-
* was still true and the line went back on the buffer, scheduled another
|
|
103
|
-
* rotation, and came back to the same answer — churning through a
|
|
104
|
-
* generation each time and never being written.
|
|
105
|
-
*
|
|
106
|
-
* A log line cannot be split, so an oversized one is written whole into a
|
|
107
|
-
* file of its own and the next line rotates. Bigger than the limit once
|
|
108
|
-
* beats absent.
|
|
109
|
-
*/
|
|
110
|
-
#needsRotation(bytes) {
|
|
111
|
-
return this.#currentSize > 0 && this.#currentSize + bytes > this.#maxSize;
|
|
112
175
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (this.#rotating || this.#closed)
|
|
176
|
+
async #writeChunk(text, bytes) {
|
|
177
|
+
const fd = this.#fd;
|
|
178
|
+
if (fd === null)
|
|
117
179
|
return;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
});
|
|
180
|
+
const buffer = Buffer.from(text, "utf8");
|
|
181
|
+
try {
|
|
182
|
+
let offset = 0;
|
|
183
|
+
while (offset < buffer.length) {
|
|
184
|
+
const { bytesWritten } = await writeFd(fd, buffer, offset, buffer.length - offset);
|
|
185
|
+
offset += bytesWritten;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
process.stderr.write(`[Spectrum] FileChannel write failed for '${this.#filePath}': ${err instanceof Error ? err.message : String(err)}\n`);
|
|
190
|
+
}
|
|
191
|
+
finally {
|
|
192
|
+
this.#currentSize += bytes;
|
|
193
|
+
this.#pendingBytes -= bytes;
|
|
194
|
+
}
|
|
135
195
|
}
|
|
196
|
+
/** Shift the generations up and leave the live path free for a new file. */
|
|
136
197
|
async #rotate() {
|
|
198
|
+
const fd = this.#fd;
|
|
199
|
+
this.#fd = null;
|
|
200
|
+
if (fd !== null)
|
|
201
|
+
await closeFd(fd).catch(() => undefined);
|
|
137
202
|
try {
|
|
138
|
-
|
|
203
|
+
if (this.#maxFiles === 1) {
|
|
204
|
+
// No generation is kept: the live file starts over.
|
|
205
|
+
await fsp.rm(this.#filePath, { force: true });
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
139
208
|
const oldest = `${this.#filePath}.${this.#maxFiles - 1}`;
|
|
140
209
|
await fsp.rm(oldest, { force: true });
|
|
141
|
-
//
|
|
142
|
-
//
|
|
143
|
-
// The i===1 pass used to take the LIVE file rather than `.1`, so `.1`
|
|
144
|
-
// was never written and the rename below found nothing left to move.
|
|
145
|
-
// With maxFiles=3 that kept one generation where two were configured,
|
|
146
|
-
// and every rotation destroyed the one before it.
|
|
210
|
+
// Oldest first: .1 → .2, .2 → .3…
|
|
147
211
|
for (let i = this.#maxFiles - 2; i >= 1; i--) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
catch {
|
|
152
|
-
// That generation does not exist yet — skip
|
|
153
|
-
}
|
|
212
|
+
await fsp
|
|
213
|
+
.rename(`${this.#filePath}.${i}`, `${this.#filePath}.${i + 1}`)
|
|
214
|
+
.catch(() => undefined); // that generation does not exist yet
|
|
154
215
|
}
|
|
155
|
-
|
|
156
|
-
await fsp.rename(this.#filePath, `${this.#filePath}.1`);
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
// Nothing to rotate
|
|
160
|
-
}
|
|
161
|
-
this.#openStream();
|
|
216
|
+
await fsp.rename(this.#filePath, `${this.#filePath}.1`);
|
|
162
217
|
}
|
|
163
218
|
catch {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
catch {
|
|
168
|
-
process.stderr.write(`[Spectrum] FileChannel: rotation failed, logging suspended for '${this.#filePath}'\n`);
|
|
169
|
-
this.#stream = null;
|
|
170
|
-
}
|
|
219
|
+
process.stderr.write(`[Spectrum] FileChannel: rotation failed for '${this.#filePath}', writing on past maxSizeBytes\n`);
|
|
220
|
+
this.#skipRotation = true;
|
|
171
221
|
}
|
|
172
222
|
}
|
|
173
|
-
#
|
|
174
|
-
|
|
223
|
+
#enqueueDropNotice() {
|
|
224
|
+
const count = this.#dropped;
|
|
225
|
+
this.#dropped = 0;
|
|
226
|
+
const line = `${jsonLine({
|
|
227
|
+
timestamp: new Date().toISOString(),
|
|
228
|
+
level: "warn",
|
|
229
|
+
module: "spectrum",
|
|
230
|
+
message: `FileChannel dropped ${count} line(s): the destination did not keep up`,
|
|
231
|
+
dropped: count,
|
|
232
|
+
})}\n`;
|
|
233
|
+
const bytes = Buffer.byteLength(line, "utf8");
|
|
234
|
+
this.#queue.push({ line, bytes });
|
|
235
|
+
this.#pendingBytes += bytes;
|
|
236
|
+
}
|
|
237
|
+
#discardQueue(reason) {
|
|
238
|
+
const lost = this.#queue.length;
|
|
239
|
+
this.#queue = [];
|
|
240
|
+
this.#pendingBytes = 0;
|
|
241
|
+
this.#dropped = 0;
|
|
242
|
+
process.stderr.write(`[Spectrum] FileChannel: '${this.#filePath}' ${reason}; ${lost} line(s) lost\n`);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Write the queue now, synchronously — the process is exiting and there is
|
|
246
|
+
* no event loop left to run the pump.
|
|
247
|
+
*
|
|
248
|
+
* A chunk already handed to an asynchronous write is left to it, as pino's
|
|
249
|
+
* destination leaves it. The file is opened non-blocking when the pump had
|
|
250
|
+
* not opened it yet, so a destination nobody reads cannot hang the exit.
|
|
251
|
+
*/
|
|
252
|
+
#flushSync() {
|
|
253
|
+
if (this.#dropped > 0)
|
|
254
|
+
this.#enqueueDropNotice();
|
|
255
|
+
if (this.#queue.length === 0)
|
|
175
256
|
return;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.#
|
|
184
|
-
|
|
257
|
+
const text = this.#queue.map((queued) => queued.line).join("");
|
|
258
|
+
this.#queue = [];
|
|
259
|
+
this.#pendingBytes = 0;
|
|
260
|
+
let fd = this.#fd;
|
|
261
|
+
let opened = false;
|
|
262
|
+
try {
|
|
263
|
+
if (fd === null) {
|
|
264
|
+
fs.mkdirSync(path.dirname(this.#filePath), { recursive: true });
|
|
265
|
+
fd = fs.openSync(this.#filePath, fs.constants.O_WRONLY |
|
|
266
|
+
fs.constants.O_APPEND |
|
|
267
|
+
fs.constants.O_CREAT |
|
|
268
|
+
(this.#truncate ? fs.constants.O_TRUNC : 0) |
|
|
269
|
+
(fs.constants.O_NONBLOCK ?? 0), 0o666);
|
|
270
|
+
opened = true;
|
|
271
|
+
}
|
|
272
|
+
const buffer = Buffer.from(text, "utf8");
|
|
273
|
+
let offset = 0;
|
|
274
|
+
while (offset < buffer.length) {
|
|
275
|
+
offset += fs.writeSync(fd, buffer, offset, buffer.length - offset);
|
|
185
276
|
}
|
|
186
|
-
this.#stream.write(line);
|
|
187
|
-
this.#currentSize += bytes;
|
|
188
277
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
stream.end(() => resolve());
|
|
197
|
-
});
|
|
278
|
+
catch {
|
|
279
|
+
process.stderr.write(`[Spectrum] FileChannel: lines lost writing '${this.#filePath}' at exit\n`);
|
|
280
|
+
}
|
|
281
|
+
finally {
|
|
282
|
+
if (opened && fd !== null)
|
|
283
|
+
fs.closeSync(fd);
|
|
284
|
+
}
|
|
198
285
|
}
|
|
199
286
|
/**
|
|
200
|
-
* Stop writing, for good.
|
|
287
|
+
* Stop writing, for good, once everything accepted is on disk.
|
|
201
288
|
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* the
|
|
289
|
+
* Every caller awaits the SAME completion — the promise itself, not a
|
|
290
|
+
* wrapper around it, which is why this is not `async`. A second `close()`
|
|
291
|
+
* that resolved while the first was still flushing let a shutdown believe
|
|
292
|
+
* the last lines were on disk when they were still queued.
|
|
206
293
|
*/
|
|
207
294
|
close() {
|
|
208
|
-
// Every caller awaits the SAME completion — the promise itself, not a
|
|
209
|
-
// wrapper around it, which is why this is not `async`. Returning early on `#closed`
|
|
210
|
-
// meant a second `close()` resolved while the first was still flushing,
|
|
211
|
-
// so a shutdown that closed two channels in parallel — or simply called
|
|
212
|
-
// this twice — believed the last lines were on disk when they were still
|
|
213
|
-
// in the stream.
|
|
214
295
|
this.#closing ??= this.#close();
|
|
215
296
|
return this.#closing;
|
|
216
297
|
}
|
|
217
|
-
/** The single closing run, memoised by {@link close}. */
|
|
218
|
-
#closing;
|
|
219
298
|
async #close() {
|
|
220
|
-
if (this.#closed)
|
|
221
|
-
return;
|
|
222
|
-
// Closed FIRST, so nothing the rotation's flush triggers schedules
|
|
223
|
-
// another one, then wait for the rotation already in flight. Without
|
|
224
|
-
// this the two ran over each other and whichever finished last decided
|
|
225
|
-
// where the final lines were.
|
|
226
299
|
this.#closed = true;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
this.#stream = null;
|
|
234
|
-
// AWAIT the flush. `end()` asks the stream to finish; it does not
|
|
235
|
-
// finish it. Returning here let a shutdown run on to `process.exit`
|
|
236
|
-
// with the last lines still buffered — and the last lines are usually
|
|
237
|
-
// the ones explaining why the process is going down.
|
|
238
|
-
await new Promise((resolve) => {
|
|
239
|
-
stream.end(() => resolve());
|
|
240
|
-
// A stream that errors will never emit `finish`, and a shutdown
|
|
241
|
-
// must not hang on a full disk or a revoked permission.
|
|
242
|
-
stream.once("error", () => resolve());
|
|
243
|
-
});
|
|
244
|
-
return;
|
|
300
|
+
while (this.#pump !== null)
|
|
301
|
+
await this.#pump;
|
|
302
|
+
const fd = this.#fd;
|
|
303
|
+
this.#fd = null;
|
|
304
|
+
if (fd !== null && !this.#fdGiven) {
|
|
305
|
+
await closeFd(fd).catch(() => undefined);
|
|
245
306
|
}
|
|
246
|
-
|
|
247
|
-
// awaiting the old one's end, and it will not reopen now that #closed is
|
|
248
|
-
// set. Writing the buffer to the stream that no longer exists is how
|
|
249
|
-
// those lines used to disappear — accepted by write(), then dropped.
|
|
250
|
-
//
|
|
251
|
-
// Appended directly instead, and synchronously, because close() is: the
|
|
252
|
-
// path is the current log either way, whether the rotation has renamed
|
|
253
|
-
// it yet or not.
|
|
254
|
-
this.#appendDirectly(pending);
|
|
307
|
+
_a.#untrack(this.#ref);
|
|
255
308
|
}
|
|
256
|
-
/**
|
|
257
|
-
#
|
|
258
|
-
|
|
309
|
+
/** Channels with lines that the `exit` hook may have to write. Weak, as pino holds its destinations. */
|
|
310
|
+
static #tracked = new Set();
|
|
311
|
+
static #track(ref) {
|
|
312
|
+
if (_a.#tracked.has(ref))
|
|
259
313
|
return;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
process.
|
|
314
|
+
if (_a.#tracked.size === 0)
|
|
315
|
+
process.on("exit", _a.#onExit);
|
|
316
|
+
_a.#tracked.add(ref);
|
|
317
|
+
}
|
|
318
|
+
static #untrack(ref) {
|
|
319
|
+
if (!_a.#tracked.delete(ref))
|
|
320
|
+
return;
|
|
321
|
+
if (_a.#tracked.size === 0) {
|
|
322
|
+
process.removeListener("exit", _a.#onExit);
|
|
269
323
|
}
|
|
270
324
|
}
|
|
325
|
+
static #onExit = () => {
|
|
326
|
+
for (const ref of _a.#tracked) {
|
|
327
|
+
const channel = ref.deref();
|
|
328
|
+
if (channel !== undefined)
|
|
329
|
+
channel.#flushSync();
|
|
330
|
+
}
|
|
331
|
+
};
|
|
271
332
|
}
|
|
333
|
+
_a = FileChannel;
|
|
272
334
|
//# sourceMappingURL=FileChannel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileChannel.js","sourceRoot":"","sources":["../../src/channels/FileChannel.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,GAAG,MAAM,kBAAkB,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AAK,MAAM,GAAG,IAAI,EAAW,CAAC,QAAQ,EAAE,CAAC;YACxC,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;YAC5B,IAAI,OAAO,KAAK,SAAS;gBAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QACjD,CAAC;IACF,CAAC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A spectrum configuration or usage error, carrying an `E_SPECTRUM_*` code an
|
|
3
|
+
* application can filter on.
|
|
4
|
+
*/
|
|
5
|
+
export declare class SpectrumError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
constructor(code: string, message: string);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAKzC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A spectrum configuration or usage error, carrying an `E_SPECTRUM_*` code an
|
|
3
|
+
* application can filter on.
|
|
4
|
+
*/
|
|
5
|
+
export class SpectrumError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
constructor(code, message) {
|
|
8
|
+
super(`[spectrum] ${message}`);
|
|
9
|
+
this.name = "SpectrumError";
|
|
10
|
+
this.code = code;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC9B,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,OAAe;QACxC,KAAK,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
* @implements FR54, FR55, FR56, FR57, FR58
|
|
5
5
|
*/
|
|
6
6
|
import "./augmentations.js";
|
|
7
|
-
export { ConsoleChannel } from "./channels/ConsoleChannel.js";
|
|
8
|
-
export { FileChannel } from "./channels/FileChannel.js";
|
|
7
|
+
export { ConsoleChannel, type ConsoleChannelOptions, } from "./channels/ConsoleChannel.js";
|
|
8
|
+
export { FileChannel, type FileChannelConfig } from "./channels/FileChannel.js";
|
|
9
9
|
export { defineConfig } from "./config.js";
|
|
10
10
|
export { configure } from "./configure.js";
|
|
11
|
+
export { SpectrumError } from "./errors.js";
|
|
11
12
|
export { clearLogListeners, type LogListener, onLog } from "./events.js";
|
|
13
|
+
export type { LineFormatters, TimestampOption } from "./jsonLine.js";
|
|
12
14
|
export { Logger, type LogLevel } from "./Logger.js";
|
|
13
15
|
export { LoggerManager } from "./LoggerManager.js";
|
|
14
|
-
export { createRustLogBridge, parseRustLog } from "./RustLogBridge.js";
|
|
16
|
+
export { createRustLogBridge, parseRustLog, type RustLogBridgeOptions, } from "./RustLogBridge.js";
|
|
17
|
+
export { stdSerializers, stdTimeFunctions } from "./stdSerializers.js";
|
|
15
18
|
export type { FileTargetOptions, PrettyTargetOptions, TransportTargetOptions, } from "./targets.js";
|
|
16
19
|
export { channelsFromTargets, Targets, targets } from "./targets.js";
|
|
17
|
-
export { isLogLevelWithSilent, type LogChannel, type LogConfig, type LogEntry, type LoggerManagerConfig, type LogLevelWithSilent, type LogSerializer, logEntryExtras, logLevel, type RedactOptions, } from "./types.js";
|
|
20
|
+
export { type ChildOptions, isLogLevelWithSilent, type LineWritable, type LogChannel, type LogConfig, type LogEntry, type LoggerManagerConfig, type LogLevelWithSilent, type LogMethodHook, type LogMixin, type LogSerializer, logEntryExtras, logLevel, type RedactOptions, } from "./types.js";
|
|
18
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,EACN,cAAc,EACd,KAAK,qBAAqB,GAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACN,mBAAmB,EACnB,YAAY,EACZ,KAAK,oBAAoB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvE,YAAY,EACX,iBAAiB,EACjB,mBAAmB,EACnB,sBA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