@trebired/logger 1.1.2 → 2.0.0

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +177 -14
  3. package/dist/browser/console_transport.d.ts +5 -0
  4. package/dist/browser/console_transport.d.ts.map +1 -0
  5. package/dist/browser/console_transport.js +51 -0
  6. package/dist/browser/console_transport.js.map +1 -0
  7. package/dist/browser/create_log.d.ts +4 -0
  8. package/dist/browser/create_log.d.ts.map +1 -0
  9. package/dist/browser/create_log.js +234 -0
  10. package/dist/browser/create_log.js.map +1 -0
  11. package/dist/browser/index.d.ts +4 -0
  12. package/dist/browser/index.d.ts.map +1 -0
  13. package/dist/browser/index.js +3 -0
  14. package/dist/browser/index.js.map +1 -0
  15. package/dist/browser/react.d.ts +30 -0
  16. package/dist/browser/react.d.ts.map +1 -0
  17. package/dist/browser/react.js +44 -0
  18. package/dist/browser/react.js.map +1 -0
  19. package/dist/constants.d.ts +2 -1
  20. package/dist/constants.d.ts.map +1 -1
  21. package/dist/constants.js +4 -1
  22. package/dist/constants.js.map +1 -1
  23. package/dist/core/create_log.d.ts.map +1 -1
  24. package/dist/core/create_log.js +111 -137
  25. package/dist/core/create_log.js.map +1 -1
  26. package/dist/core/shared.d.ts +31 -0
  27. package/dist/core/shared.d.ts.map +1 -0
  28. package/dist/core/shared.js +144 -0
  29. package/dist/core/shared.js.map +1 -0
  30. package/dist/format/console.d.ts +2 -2
  31. package/dist/format/console.d.ts.map +1 -1
  32. package/dist/format/console.js +2 -17
  33. package/dist/format/console.js.map +1 -1
  34. package/dist/format/options.d.ts +4 -0
  35. package/dist/format/options.d.ts.map +1 -0
  36. package/dist/format/options.js +19 -0
  37. package/dist/format/options.js.map +1 -0
  38. package/dist/index.d.ts +4 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +3 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/storage/names.d.ts +10 -3
  43. package/dist/storage/names.d.ts.map +1 -1
  44. package/dist/storage/names.js +76 -33
  45. package/dist/storage/names.js.map +1 -1
  46. package/dist/storage/options.d.ts.map +1 -1
  47. package/dist/storage/options.js +3 -1
  48. package/dist/storage/options.js.map +1 -1
  49. package/dist/storage/partitions.d.ts +30 -0
  50. package/dist/storage/partitions.d.ts.map +1 -0
  51. package/dist/storage/partitions.js +564 -0
  52. package/dist/storage/partitions.js.map +1 -0
  53. package/dist/storage/query.d.ts +8 -4
  54. package/dist/storage/query.d.ts.map +1 -1
  55. package/dist/storage/query.js +135 -28
  56. package/dist/storage/query.js.map +1 -1
  57. package/dist/storage/retention.d.ts.map +1 -1
  58. package/dist/storage/retention.js +51 -2
  59. package/dist/storage/retention.js.map +1 -1
  60. package/dist/storage/walk.d.ts.map +1 -1
  61. package/dist/storage/walk.js +65 -9
  62. package/dist/storage/walk.js.map +1 -1
  63. package/dist/storage/write.d.ts +1 -0
  64. package/dist/storage/write.d.ts.map +1 -1
  65. package/dist/storage/write.js +12 -1
  66. package/dist/storage/write.js.map +1 -1
  67. package/dist/stream/index.d.ts +11 -3
  68. package/dist/stream/index.d.ts.map +1 -1
  69. package/dist/stream/index.js +40 -4
  70. package/dist/stream/index.js.map +1 -1
  71. package/dist/types.d.ts +189 -4
  72. package/dist/types.d.ts.map +1 -1
  73. package/package.json +24 -3
package/CHANGELOG.md CHANGED
@@ -4,12 +4,33 @@ All notable changes to `@trebired/logger` will be documented here.
4
4
 
5
5
  This project follows semantic versioning once published.
6
6
 
7
+ ## 2.0.0
8
+
9
+ - Added `@trebired/logger/browser` for framework-neutral browser logging with the same levels, metadata conventions, grouping rules, and scoped logger behavior as the server logger.
10
+ - Added `@trebired/logger/browser/react` with `LogProvider`, `useLog()`, and `LogErrorBoundary` as a thin React adapter on top of the browser runtime.
11
+ - Added a runtime-neutral log stream context so stream listeners can distinguish `{ runtime: "server", dir }` from `{ runtime: "browser", transports }`.
12
+ - Rebuilt partition handling as a clean-break subsystem with no legacy partition marker or legacy log filename compatibility.
13
+ - Added partition naming helpers for time-prefixed names, arbitrary caller suffixes, full-name sanitization, and temporary partition names.
14
+ - Added live partition lifecycle APIs on logger instances, including `getPartition()`, `setPartition()`, `promotePartition()`, `listPartitions()`, and `getPartitionInfo()`.
15
+ - Added standalone partition management helpers for creating, listing, inspecting, renaming, moving, copying, merging, and deleting partitions.
16
+ - Added `deleteLogs()` for file-bucket deletion by partition, age, day, hour, group, level, and temporary-partition filters.
17
+ - Changed query metadata and partition summaries to use real partition names or `null` for unpartitioned logs.
18
+
19
+ ## 1.1.3
20
+
21
+ - Added optional `partition` storage folders so one logger dir can keep separate deployments, sessions, environments, or other caller-defined log trees.
22
+ - Added `maxPartitions` retention cleanup and changed retention defaults so logs are kept forever unless a deletion number is configured.
23
+ - Added `metadata.total` and `metadata.partitions` summaries to saved-log query results.
24
+ - Replaced the old query API names with `getAllLogs()`, `getAllLogsAcrossPartitions()`, and `getLogsForDir()`.
25
+ - Removed support for `getAll()` and `getEntriesForDir()`.
26
+
7
27
  ## 1.1.2
8
28
 
9
29
  - Changed saved-log query helpers to return `{ logs, levels, metadata }` instead of a bare log array.
10
30
  - Added top-level level configuration metadata to query results, including custom logger levels.
11
31
  - Added a continuous dummy logger demo that writes to the OS temp directory and exits cleanly on interrupt.
12
32
  - Documented that the demo supports Linux and macOS; microslop Windows is not supported.
33
+ - Removed configurable `defaultGroup`; the implicit group is now always hardcoded to `"default"`.
13
34
 
14
35
  ## 0.1.0
15
36
 
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @trebired/logger
2
2
 
3
- Structured backend logging for Bun and Node.js applications that want readable console output and durable local logs without running a separate logging stack.
3
+ Structured logging for server and browser applications that want one event model, readable console output, and durable local logs without running a separate logging stack.
4
4
 
5
- `@trebired/logger` writes JSONL logs into group-based folders, supports custom weighted levels, queues file writes by default, and includes redaction, retention, rolling files, request-scoped loggers, and local query helpers.
5
+ `@trebired/logger` writes JSONL logs into group-based folders on the server, supports optional partitioned storage, and now ships a framework-neutral browser runtime with an optional React adapter on top.
6
6
 
7
7
  ## Install
8
8
 
@@ -25,12 +25,71 @@ log.info("app.start", "ready", { port: 3000 });
25
25
  await log.flush();
26
26
  ```
27
27
 
28
+ Browser entrypoints:
29
+
30
+ ```ts
31
+ import { createBrowserLog } from "@trebired/logger/browser";
32
+ import { LogProvider, useLog } from "@trebired/logger/browser/react";
33
+ ```
34
+
35
+ ## Browser Runtime
36
+
37
+ Use `@trebired/logger/browser` when you want the same levels, metadata conventions, grouping rules, and scoped logger behavior in browser code:
38
+
39
+ ```ts
40
+ import { createBrowserLog } from "@trebired/logger/browser";
41
+
42
+ const log = createBrowserLog({
43
+ group: "frontend.app",
44
+ metadata: {
45
+ deploymentId: "deploy-42",
46
+ requestId: "req-abc",
47
+ },
48
+ });
49
+
50
+ log.info("frontend boot");
51
+ await log.flush();
52
+ ```
53
+
54
+ The first browser release ships with console delivery built in. It also supports custom browser transports with in-memory batching so you can add fetch, beacon, websocket, or other delivery later without changing the logger API.
55
+
56
+ There is no built-in SSR bootstrap helper in this release. If you want browser correlation data such as `requestId`, `sessionId`, or `deploymentId`, pass it explicitly through `metadata` or per-log metadata.
57
+
58
+ ## React Adapter
59
+
60
+ `@trebired/logger/browser/react` is intentionally thin. It does not create a logger for you. It only helps wire an existing browser logger into React context:
61
+
62
+ ```tsx
63
+ import { createRoot } from "react-dom/client";
64
+ import { createBrowserLog } from "@trebired/logger/browser";
65
+ import { LogProvider, useLog } from "@trebired/logger/browser/react";
66
+
67
+ const log = createBrowserLog({
68
+ group: "frontend.app",
69
+ metadata: { deploymentId: "deploy-42" },
70
+ });
71
+
72
+ function SaveButton() {
73
+ const scopedLog = useLog("ui.save_button");
74
+ return <button onClick={() => scopedLog.info("clicked")}>Save</button>;
75
+ }
76
+
77
+ createRoot(document.getElementById("root")!).render(
78
+ <LogProvider log={log}>
79
+ <SaveButton />
80
+ </LogProvider>,
81
+ );
82
+ ```
83
+
84
+ `LogErrorBoundary` is also available from `@trebired/logger/browser/react` when you want render errors logged with the shared event shape.
85
+
28
86
  ## Why This Logger
29
87
 
30
88
  Most loggers either write to stdout and expect an external collector, or provide a very broad transport system. This package is intentionally opinionated around a simpler operational workflow:
31
89
 
32
90
  - structured JSONL entries
33
91
  - one directory tree per log group
92
+ - optional partition folders above group trees
34
93
  - async queued file writes by default
35
94
  - custom weighted log levels
36
95
  - local querying by group, level, day, and hour
@@ -55,6 +114,88 @@ Each line is a JSON object:
55
114
  {"recorded_at":"2026-05-03T13:00:00.000Z","level":"info","group":"app.start","message":"ready","origin":{"source":"app","instance":null},"metadata":{"port":3000}}
56
115
  ```
57
116
 
117
+ If you want an extra top-level separation layer, set `partition` and the logger writes one more folder layer. This is useful for deployments, releases, environments, sessions, tenants, workers, import batches, or any other caller-defined bucket:
118
+
119
+ ```txt
120
+ /var/log/my-app/
121
+ blue-2026-05-16/
122
+ app/
123
+ start/
124
+ 2026-05-03-13-0000-info.jsonl
125
+ ```
126
+
127
+ Partition names can now be built from a stable time prefix plus any caller-defined suffix:
128
+
129
+ ```ts
130
+ import {
131
+ buildPartitionName,
132
+ buildTemporaryPartitionName,
133
+ createLog,
134
+ } from "@trebired/logger";
135
+
136
+ const staged = buildTemporaryPartitionName({
137
+ timeZone: "UTC",
138
+ suffix: "deployment-unknown",
139
+ });
140
+
141
+ const final = buildPartitionName({
142
+ timeZone: "UTC",
143
+ suffix: "deployment-42",
144
+ });
145
+
146
+ const log = createLog({
147
+ dir: "/var/log/my-app",
148
+ partition: staged,
149
+ temporaryPartition: true,
150
+ });
151
+
152
+ log.info("app.boot", "starting before final ownership is known");
153
+ await log.flush();
154
+
155
+ await log.promotePartition(final);
156
+ ```
157
+
158
+ If you already have a full custom partition string, pass it directly with `partition`, or normalize it first with `sanitizePartitionName()`.
159
+
160
+ ## Partition Lifecycle
161
+
162
+ You can manage partitions either from a live logger or with standalone helpers:
163
+
164
+ ```ts
165
+ import {
166
+ copyPartition,
167
+ createPartition,
168
+ deleteLogs,
169
+ listPartitions,
170
+ renamePartition,
171
+ } from "@trebired/logger";
172
+
173
+ await createPartition("/var/log/my-app", "2026-05-17-12-0000-staged", {
174
+ temporary: true,
175
+ });
176
+
177
+ console.log(await listPartitions("/var/log/my-app"));
178
+
179
+ await renamePartition("/var/log/my-app", {
180
+ from: "2026-05-17-12-0000-staged",
181
+ to: "2026-05-17-12-0000-final",
182
+ });
183
+
184
+ await copyPartition({
185
+ fromDir: "/var/log/my-app",
186
+ from: "2026-05-17-12-0000-final",
187
+ toDir: "/var/log/archive",
188
+ to: "2026-05-17-12-0000-final-copy",
189
+ });
190
+
191
+ await deleteLogs("/var/log/my-app", {
192
+ partition: "2026-05-17-12-0000-final",
193
+ groupKey: "jobs.queue",
194
+ level: "warn",
195
+ olderThanDays: 7,
196
+ });
197
+ ```
198
+
58
199
  ## Core API
59
200
 
60
201
  ```ts
@@ -64,7 +205,6 @@ const log = createLog({
64
205
  console: true,
65
206
  timeZone: "America/New_York",
66
207
  source: "api",
67
- defaultGroup: "default",
68
208
  });
69
209
 
70
210
  log.debug("app.boot", "config loaded");
@@ -77,7 +217,7 @@ log.error("app.runtime", "uncaught error");
77
217
 
78
218
  `save` defaults to `true` when `dir` is provided. If no `dir` is provided, the logger can still emit console output and live stream events.
79
219
 
80
- `defaultGroup` defaults to `"default"`.
220
+ If you log without passing a group, the logger always uses `"default"`.
81
221
 
82
222
  `@trebired/logger` runs on both Bun and Node.js. It may print one-time package notices for runtime-specific guidance or important future package messages. For example, when it detects Node.js, it recommends Bun for best startup and file I/O performance. Pass `quiet: true` to suppress package notices:
83
223
 
@@ -117,6 +257,8 @@ import { createLog } from "@trebired/logger";
117
257
 
118
258
  const log = createLog({
119
259
  dir: "/var/log/my-app",
260
+ partition: "blue-2026-05-16",
261
+ temporaryPartition: false,
120
262
  save: true,
121
263
  console: {
122
264
  enabled: true,
@@ -129,7 +271,6 @@ const log = createLog({
129
271
  quiet: true,
130
272
  timeZone: "America/New_York",
131
273
  source: "api",
132
- defaultGroup: "default",
133
274
  levels: {
134
275
  debug: { weight: 10, label: "DEBUG", color: "#94a3b8" },
135
276
  info: { weight: 20, label: "INFO", color: "#38bdf8" },
@@ -148,10 +289,12 @@ const log = createLog({
148
289
  },
149
290
  retention: {
150
291
  enabled: true,
151
- maxAgeDays: 7,
152
292
  maxFileSize: "20mb",
153
293
  compressOldFiles: false,
154
294
  cleanupIntervalMs: 60_000,
295
+ // deletion is opt-in:
296
+ maxAgeDays: 30,
297
+ maxPartitions: 5,
155
298
  },
156
299
  redact: {
157
300
  includeDefaultSensitiveKeys: true,
@@ -242,8 +385,7 @@ const log = createLog({
242
385
 
243
386
  Defaults:
244
387
 
245
- - retention enabled
246
- - `maxAgeDays: 7`
388
+ - logs are kept forever unless you set a retention number
247
389
  - `maxFileSize: "20mb"`
248
390
  - `compressOldFiles: false`
249
391
 
@@ -251,7 +393,9 @@ Defaults:
251
393
  const log = createLog({
252
394
  dir: "/var/log/my-app",
253
395
  retention: {
396
+ // only delete when you set one or both of these:
254
397
  maxAgeDays: 30,
398
+ maxPartitions: 5,
255
399
  maxFileSize: "100mb",
256
400
  compressOldFiles: true,
257
401
  cleanupIntervalMs: 60 * 60 * 1000,
@@ -259,6 +403,8 @@ const log = createLog({
259
403
  });
260
404
  ```
261
405
 
406
+ `maxAgeDays` deletes old files by age. `maxPartitions` keeps only the newest partition folders by last write time. A partition can represent deployments, sessions, environments, release versions, or any other caller-defined grouping. If you omit both, the logger stores logs indefinitely.
407
+
262
408
  When a file exceeds the configured size, the logger rolls to the next sequence inside the same group and hour:
263
409
 
264
410
  ```txt
@@ -317,10 +463,12 @@ app.get("/", (req, res) => {
317
463
 
318
464
  ## Query Saved Logs
319
465
 
466
+ Old query names are not supported anymore. Use `getLogsForDir()`, `getAllLogs()`, and `getAllLogsAcrossPartitions()`. Do not use `getEntriesForDir()` or `getAll()`.
467
+
320
468
  ```ts
321
- import { getEntriesForDir } from "@trebired/logger";
469
+ import { getLogsForDir } from "@trebired/logger";
322
470
 
323
- const result = await getEntriesForDir("/var/log/my-app", {
471
+ const result = await getLogsForDir("/var/log/my-app", {
324
472
  level: "error",
325
473
  groupKey: "app.runtime",
326
474
  limit: 100,
@@ -329,14 +477,30 @@ const result = await getEntriesForDir("/var/log/my-app", {
329
477
  console.log(result.logs);
330
478
  console.log(result.levels.error.color);
331
479
  console.log(result.metadata.count);
480
+ console.log(result.metadata.total);
332
481
  ```
333
482
 
334
- Logger instances also expose `getAll()`:
483
+ The main instance query method is `getAllLogs()`:
335
484
 
336
485
  ```ts
337
- const recent = await log.getAll({ groupKey: "billing.invoice", limit: 50 });
486
+ const recent = await log.getAllLogs({ groupKey: "billing.invoice", limit: 50 });
338
487
  console.log(recent.logs);
339
488
  console.log(recent.levels);
489
+ console.log(recent.metadata.total);
490
+ ```
491
+
492
+ Pass `partition: null` when you want only unpartitioned logs from a mixed directory tree.
493
+
494
+ If you use partition folders and want a merged read across every partition:
495
+
496
+ ```ts
497
+ const merged = await log.getAllLogsAcrossPartitions({
498
+ groupKey: "billing.invoice",
499
+ limit: 100,
500
+ });
501
+
502
+ console.log(merged.logs);
503
+ console.log(merged.metadata.partitions.items);
340
504
  ```
341
505
 
342
506
  ## Sampling
@@ -369,9 +533,8 @@ bun run demo
369
533
  bun test
370
534
  bun run typecheck
371
535
  bun run build
372
- bun run bench
373
536
  ```
374
537
 
375
- `bun run demo` starts a small dummy system that keeps logging until interrupted. It exercises grouped and scoped loggers, custom levels, redaction, request middleware, live stream events, local querying, and write stats. It writes throwaway logs under the OS temp directory, such as `/tmp/@trebired-logger/dummy-system` on Linux and macOS. Microslop Windows is not supported.
538
+ `bun run demo` starts a small dummy system that keeps logging until interrupted. It exercises grouped and scoped loggers, custom levels, redaction, request middleware, live stream events, local querying, and write stats. It writes throwaway logs under the OS temp directory, such as `/tmp/@trebired-logger/dummy` on Linux and macOS. Microslop Windows is not supported.
376
539
 
377
540
  The npm package exports compiled files from `dist`. Publishing runs `typecheck`, tests, and `build` through `prepublishOnly`.
@@ -0,0 +1,5 @@
1
+ import type { BrowserConsoleTransportOptions, BrowserTransport, LogEntry, LogLevelConfig, NormalizedConsoleOptions } from "../types.js";
2
+ declare function formatBrowserConsoleLine(entry: LogEntry, levelConfig: LogLevelConfig, options: NormalizedConsoleOptions, timeZone: string): string;
3
+ declare function createConsoleTransport(options?: BrowserConsoleTransportOptions): BrowserTransport;
4
+ export { createConsoleTransport, formatBrowserConsoleLine };
5
+ //# sourceMappingURL=console_transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console_transport.d.ts","sourceRoot":"","sources":["../../src/browser/console_transport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,8BAA8B,EAC9B,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,wBAAwB,EACzB,MAAM,aAAa,CAAC;AASrB,iBAAS,wBAAwB,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAW3I;AAED,iBAAS,sBAAsB,CAAC,OAAO,GAAE,8BAAmC,GAAG,gBAAgB,CA0B9F;AAED,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { formatDisplayTimestamp } from "../utils/datetime.js";
2
+ import { normalizeConsoleOptions } from "../format/options.js";
3
+ import { normalizeLevels } from "../levels/index.js";
4
+ function consoleMethodName(level, levelConfig) {
5
+ if (level === "debug")
6
+ return "debug";
7
+ if (levelConfig.stream === "stderr")
8
+ return level === "warn" ? "warn" : "error";
9
+ if (level === "info" || level === "success")
10
+ return "info";
11
+ return "log";
12
+ }
13
+ function formatBrowserConsoleLine(entry, levelConfig, options, timeZone) {
14
+ const bracketParts = [levelConfig.label || entry.level.toUpperCase()];
15
+ if (options.group)
16
+ bracketParts.push(entry.group);
17
+ let line = `[${bracketParts.join(", ")}] ${entry.message}`;
18
+ if (options.timestamp) {
19
+ line = `|${formatDisplayTimestamp(entry.recorded_at, options.locale, timeZone)}| ${line}`;
20
+ }
21
+ return line;
22
+ }
23
+ function createConsoleTransport(options = {}) {
24
+ const consoleOptions = normalizeConsoleOptions(options.console);
25
+ const timeZone = options.timeZone || "UTC";
26
+ const levels = normalizeLevels(options.levels);
27
+ return {
28
+ name: "console",
29
+ write(entries) {
30
+ if (!consoleOptions.enabled)
31
+ return;
32
+ const target = globalThis.console;
33
+ if (!target)
34
+ return;
35
+ for (const entry of entries) {
36
+ const levelConfig = levels[entry.level] || levels.info;
37
+ const methodName = consoleMethodName(entry.level, levelConfig);
38
+ const method = typeof target[methodName] === "function" ? target[methodName] : target.log;
39
+ const line = formatBrowserConsoleLine(entry, levelConfig, consoleOptions, timeZone);
40
+ const args = [line];
41
+ if (consoleOptions.metadata && entry.metadata && Object.keys(entry.metadata).length)
42
+ args.push(entry.metadata);
43
+ if (levelConfig.showStack === true && entry.metadata && entry.metadata.stack)
44
+ args.push(String(entry.metadata.stack));
45
+ method.apply(target, args);
46
+ }
47
+ },
48
+ };
49
+ }
50
+ export { createConsoleTransport, formatBrowserConsoleLine };
51
+ //# sourceMappingURL=console_transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console_transport.js","sourceRoot":"","sources":["../../src/browser/console_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AASrD,SAAS,iBAAiB,CAAC,KAAa,EAAE,WAA2B;IACnE,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IACtC,IAAI,WAAW,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChF,IAAI,K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AM,CAAC,IAAI,CAAC;gBACvD,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;gBAC/D,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;gBAC1F,MAAM,IAAI,GAAG,wBAAwB,CAAC,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;gBACpF,MAAM,IAAI,GAAc,CAAC,IAAI,CAAC,CAAC;gBAE/B,IAAI,cAAc,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM;oBAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC/G,IAAI,WAAW,CAAC,SAAS,KAAK,IAAI,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK;oBAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gBAEtH,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BrowserLogInstance, BrowserLogOptions } from "../types.js";
2
+ declare function createBrowserLog(options?: BrowserLogOptions): BrowserLogInstance;
3
+ export { createBrowserLog };
4
+ //# sourceMappingURL=create_log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_log.d.ts","sourceRoot":"","sources":["../../src/browser/create_log.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAKlB,MAAM,aAAa,CAAC;AA2NrB,iBAAS,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,kBAAkB,CAkC7E;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,234 @@
1
+ import { createCommonLogger } from "../core/shared.js";
2
+ import { normalizeLevels } from "../levels/index.js";
3
+ import { logStream } from "../stream/index.js";
4
+ import { normalizeTimeZone } from "../utils/datetime.js";
5
+ import { asObject, toString } from "../utils/values.js";
6
+ import { createConsoleTransport } from "./console_transport.js";
7
+ function normalizeBatchOptions(input) {
8
+ const cfg = input && typeof input === "object" ? input : {};
9
+ const size = Number(cfg.size);
10
+ const delayMs = Number(cfg.delayMs);
11
+ const maxQueue = Number(cfg.maxQueue);
12
+ return {
13
+ size: Number.isFinite(size) && size > 0 ? Math.floor(size) : 20,
14
+ delayMs: Number.isFinite(delayMs) && delayMs >= 0 ? Math.floor(delayMs) : 1000,
15
+ maxQueue: Number.isFinite(maxQueue) && maxQueue > 0 ? Math.floor(maxQueue) : 1000,
16
+ overflow: cfg.overflow === "drop-oldest" || cfg.overflow === "throw" ? cfg.overflow : "drop-newest",
17
+ };
18
+ }
19
+ function resolveTransports(options, levels, timeZone) {
20
+ const transportInputs = Array.isArray(options.transports) ? options.transports : ["console"];
21
+ const resolved = [];
22
+ for (const input of transportInputs) {
23
+ if (input === "console") {
24
+ if (options.console === false)
25
+ continue;
26
+ resolved.push({
27
+ transport: createConsoleTransport({
28
+ console: options.console,
29
+ timeZone,
30
+ levels,
31
+ }),
32
+ immediate: true,
33
+ });
34
+ continue;
35
+ }
36
+ if (!input || typeof input !== "object")
37
+ continue;
38
+ if (typeof input.available === "function" && input.available() !== true)
39
+ continue;
40
+ resolved.push({ transport: input, immediate: false });
41
+ }
42
+ return resolved;
43
+ }
44
+ class BrowserTransportManager {
45
+ constructor(transports, batchOptions) {
46
+ this.queue = [];
47
+ this.timer = null;
48
+ this.flushing = null;
49
+ this.closed = false;
50
+ this.immediateTransports = transports.filter((item) => item.immediate).map((item) => item.transport);
51
+ this.batchedTransports = transports.filter((item) => !item.immediate).map((item) => item.transport);
52
+ this.batchOptions = normalizeBatchOptions(batchOptions);
53
+ this.stats = {
54
+ queued: 0,
55
+ written: 0,
56
+ dropped: 0,
57
+ failed: 0,
58
+ queueLength: 0,
59
+ closed: false,
60
+ transports: transports.map((item) => item.transport.name),
61
+ };
62
+ }
63
+ getContext() {
64
+ return {
65
+ runtime: "browser",
66
+ transports: this.stats.transports.slice(),
67
+ };
68
+ }
69
+ write(entry) {
70
+ if (this.closed) {
71
+ this.stats.dropped += 1;
72
+ return;
73
+ }
74
+ let wroteImmediate = false;
75
+ for (const transport of this.immediateTransports) {
76
+ try {
77
+ const result = transport.write([entry], this.getContext());
78
+ if (result && typeof result.catch === "function") {
79
+ void result.catch(() => {
80
+ this.stats.failed += 1;
81
+ });
82
+ }
83
+ wroteImmediate = true;
84
+ }
85
+ catch {
86
+ this.stats.failed += 1;
87
+ }
88
+ }
89
+ if (wroteImmediate)
90
+ this.stats.written += 1;
91
+ if (!this.batchedTransports.length)
92
+ return;
93
+ if (this.queue.length >= this.batchOptions.maxQueue) {
94
+ if (this.batchOptions.overflow === "throw")
95
+ throw new Error("browser-log-queue-full");
96
+ if (this.batchOptions.overflow === "drop-oldest")
97
+ this.queue.shift();
98
+ this.stats.dropped += 1;
99
+ if (this.batchOptions.overflow === "drop-newest")
100
+ return;
101
+ }
102
+ this.queue.push(entry);
103
+ this.stats.queued += 1;
104
+ this.stats.queueLength = this.queue.length;
105
+ if (this.queue.length >= this.batchOptions.size) {
106
+ void this.flushQueue();
107
+ return;
108
+ }
109
+ this.ensureTimer();
110
+ }
111
+ async flush() {
112
+ this.clearTimer();
113
+ await this.flushQueue();
114
+ for (const transport of [...this.immediateTransports, ...this.batchedTransports]) {
115
+ if (typeof transport.flush !== "function")
116
+ continue;
117
+ try {
118
+ await transport.flush();
119
+ }
120
+ catch {
121
+ this.stats.failed += Math.max(1, this.queue.length);
122
+ }
123
+ }
124
+ }
125
+ async close() {
126
+ if (this.closed)
127
+ return;
128
+ this.closed = true;
129
+ this.stats.closed = true;
130
+ this.clearTimer();
131
+ await this.flush();
132
+ for (const transport of [...this.immediateTransports, ...this.batchedTransports]) {
133
+ if (typeof transport.close !== "function")
134
+ continue;
135
+ try {
136
+ await transport.close();
137
+ }
138
+ catch {
139
+ this.stats.failed += 1;
140
+ }
141
+ }
142
+ }
143
+ getStats() {
144
+ return {
145
+ ...this.stats,
146
+ queueLength: this.queue.length,
147
+ closed: this.closed,
148
+ transports: this.stats.transports.slice(),
149
+ };
150
+ }
151
+ ensureTimer() {
152
+ if (this.timer || this.closed || this.batchOptions.delayMs <= 0)
153
+ return;
154
+ this.timer = setTimeout(() => {
155
+ this.timer = null;
156
+ void this.flushQueue();
157
+ }, this.batchOptions.delayMs);
158
+ }
159
+ clearTimer() {
160
+ if (!this.timer)
161
+ return;
162
+ clearTimeout(this.timer);
163
+ this.timer = null;
164
+ }
165
+ async flushQueue() {
166
+ if (!this.batchedTransports.length || this.queue.length === 0)
167
+ return;
168
+ if (this.flushing) {
169
+ await this.flushing;
170
+ if (this.queue.length > 0)
171
+ await this.flushQueue();
172
+ return;
173
+ }
174
+ this.flushing = (async () => {
175
+ while (this.queue.length > 0) {
176
+ const entries = this.queue.splice(0, this.queue.length);
177
+ this.stats.queueLength = this.queue.length;
178
+ let failed = false;
179
+ for (const transport of this.batchedTransports) {
180
+ try {
181
+ await transport.write(entries, this.getContext());
182
+ }
183
+ catch {
184
+ failed = true;
185
+ }
186
+ }
187
+ if (failed)
188
+ this.stats.failed += entries.length;
189
+ else if (this.immediateTransports.length === 0)
190
+ this.stats.written += entries.length;
191
+ }
192
+ })().finally(() => {
193
+ this.flushing = null;
194
+ this.stats.queueLength = this.queue.length;
195
+ });
196
+ await this.flushing;
197
+ }
198
+ }
199
+ function createBrowserLog(options = {}) {
200
+ const cfg = options && typeof options === "object" ? options : {};
201
+ const levels = normalizeLevels(cfg.levels);
202
+ const timeZone = normalizeTimeZone(cfg.timeZone);
203
+ const transports = resolveTransports(cfg, levels, timeZone);
204
+ const manager = new BrowserTransportManager(transports, cfg.batch);
205
+ const { api } = createCommonLogger({
206
+ levels,
207
+ minLevel: cfg.minLevel,
208
+ defaultSource: toString(cfg.source) || "browser",
209
+ defaultGroup: toString(cfg.group) || undefined,
210
+ defaultMetadata: asObject(cfg.metadata),
211
+ serializers: cfg.serializers,
212
+ redact: cfg.redact,
213
+ sample: cfg.sample,
214
+ writeEntry(entry) {
215
+ manager.write(entry);
216
+ try {
217
+ logStream.emit("log", entry, manager.getContext());
218
+ }
219
+ catch { }
220
+ },
221
+ flush() {
222
+ return manager.flush();
223
+ },
224
+ close() {
225
+ return manager.close();
226
+ },
227
+ getStats() {
228
+ return manager.getStats();
229
+ },
230
+ });
231
+ return api;
232
+ }
233
+ export { createBrowserLog };
234
+ //# sourceMappingURL=create_log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_log.js","sourceRoot":"","sources":["../../src/browser/create_log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAchE,SAAS,qBAAqB,CAAC,KAA2B;IACxD,MAAM,GAAG,GAAG,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B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OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,IAAI,CAAC;gBACH,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;YACrD,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACZ,CAAC;QACD,KAAK;YACH,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;QACD,KAAK;YACH,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;QACD,QAAQ;YACN,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,GAAyB,CAAC;AACnC,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { createBrowserLog } from "./create_log.js";
2
+ export { createConsoleTransport } from "./console_transport.js";
3
+ export type { BrowserBatchOptions, BrowserConsoleTransportOptions, BrowserLogInstance, BrowserLogOptions, BrowserLogStats, BrowserTransport, BrowserTransportContext, } from "../types.js";
4
+ //# sourceMappingURL=index.d.ts.map