evlog 2.4.1 → 2.6.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 (154) hide show
  1. package/README.md +2 -1
  2. package/dist/{_http-DVDwNag0.mjs → _http-DHpGetLZ.mjs} +2 -6
  3. package/dist/{_http-DVDwNag0.mjs.map → _http-DHpGetLZ.mjs.map} +1 -1
  4. package/dist/{_severity-78FkT5MD.mjs → _severity-Q1BuITU_.mjs} +2 -2
  5. package/dist/{_severity-78FkT5MD.mjs.map → _severity-Q1BuITU_.mjs.map} +1 -1
  6. package/dist/adapters/axiom.d.mts +1 -1
  7. package/dist/adapters/axiom.d.mts.map +1 -1
  8. package/dist/adapters/axiom.mjs +2 -3
  9. package/dist/adapters/axiom.mjs.map +1 -1
  10. package/dist/adapters/better-stack.d.mts +1 -1
  11. package/dist/adapters/better-stack.d.mts.map +1 -1
  12. package/dist/adapters/better-stack.mjs +2 -3
  13. package/dist/adapters/better-stack.mjs.map +1 -1
  14. package/dist/adapters/otlp.d.mts +1 -1
  15. package/dist/adapters/otlp.d.mts.map +1 -1
  16. package/dist/adapters/otlp.mjs +14 -11
  17. package/dist/adapters/otlp.mjs.map +1 -1
  18. package/dist/adapters/posthog.d.mts +1 -1
  19. package/dist/adapters/posthog.d.mts.map +1 -1
  20. package/dist/adapters/posthog.mjs +2 -3
  21. package/dist/adapters/posthog.mjs.map +1 -1
  22. package/dist/adapters/sentry.d.mts +1 -1
  23. package/dist/adapters/sentry.d.mts.map +1 -1
  24. package/dist/adapters/sentry.mjs +3 -4
  25. package/dist/adapters/sentry.mjs.map +1 -1
  26. package/dist/browser.d.mts +1 -1
  27. package/dist/browser.mjs +1 -2
  28. package/dist/browser.mjs.map +1 -1
  29. package/dist/{dist-By0jiJRA.mjs → dist-BsWcv7B8.mjs} +3 -4
  30. package/dist/{dist-By0jiJRA.mjs.map → dist-BsWcv7B8.mjs.map} +1 -1
  31. package/dist/elysia/index.d.mts +2 -2
  32. package/dist/elysia/index.mjs +2 -3
  33. package/dist/elysia/index.mjs.map +1 -1
  34. package/dist/enrichers.d.mts +1 -1
  35. package/dist/enrichers.mjs +1 -1
  36. package/dist/enrichers.mjs.map +1 -1
  37. package/dist/error-iV3zJCY3.d.mts +65 -0
  38. package/dist/error-iV3zJCY3.d.mts.map +1 -0
  39. package/dist/error.d.mts +2 -65
  40. package/dist/error.mjs +1 -2
  41. package/dist/error.mjs.map +1 -1
  42. package/dist/errors-BJRXUfMg.mjs +18 -0
  43. package/dist/errors-BJRXUfMg.mjs.map +1 -0
  44. package/dist/errors-CKSfdvLa.d.mts +39 -0
  45. package/dist/errors-CKSfdvLa.d.mts.map +1 -0
  46. package/dist/express/index.d.mts +2 -2
  47. package/dist/express/index.mjs +3 -4
  48. package/dist/express/index.mjs.map +1 -1
  49. package/dist/fastify/index.d.mts +2 -2
  50. package/dist/fastify/index.d.mts.map +1 -1
  51. package/dist/fastify/index.mjs +3 -4
  52. package/dist/fastify/index.mjs.map +1 -1
  53. package/dist/{headers-CXOd5EyZ.mjs → headers-Ba1eKT3i.mjs} +6 -6
  54. package/dist/headers-Ba1eKT3i.mjs.map +1 -0
  55. package/dist/hono/index.d.mts +2 -2
  56. package/dist/hono/index.mjs +2 -3
  57. package/dist/hono/index.mjs.map +1 -1
  58. package/dist/index.d.mts +5 -5
  59. package/dist/index.mjs +1 -2
  60. package/dist/logger-CvDYZUze.d.mts +59 -0
  61. package/dist/logger-CvDYZUze.d.mts.map +1 -0
  62. package/dist/logger.d.mts +2 -59
  63. package/dist/logger.mjs +45 -3
  64. package/dist/logger.mjs.map +1 -1
  65. package/dist/middleware-hZqyXoSk.d.mts +75 -0
  66. package/dist/middleware-hZqyXoSk.d.mts.map +1 -0
  67. package/dist/nestjs/index.d.mts +2 -2
  68. package/dist/nestjs/index.mjs +3 -4
  69. package/dist/nestjs/index.mjs.map +1 -1
  70. package/dist/next/client.d.mts +1 -1
  71. package/dist/next/client.mjs +2 -4
  72. package/dist/next/client.mjs.map +1 -1
  73. package/dist/next/index.d.mts +4 -4
  74. package/dist/next/index.d.mts.map +1 -1
  75. package/dist/next/index.mjs +2 -6
  76. package/dist/next/index.mjs.map +1 -1
  77. package/dist/nitro/errorHandler.mjs +3 -3
  78. package/dist/nitro/errorHandler.mjs.map +1 -1
  79. package/dist/nitro/module.d.mts +2 -2
  80. package/dist/nitro/module.mjs +1 -2
  81. package/dist/nitro/module.mjs.map +1 -1
  82. package/dist/nitro/plugin.mjs +3 -4
  83. package/dist/nitro/plugin.mjs.map +1 -1
  84. package/dist/nitro/v3/errorHandler.mjs +4 -4
  85. package/dist/nitro/v3/errorHandler.mjs.map +1 -1
  86. package/dist/nitro/v3/index.mjs +1 -2
  87. package/dist/nitro/v3/middleware.mjs +1 -2
  88. package/dist/nitro/v3/middleware.mjs.map +1 -1
  89. package/dist/nitro/v3/module.d.mts +1 -1
  90. package/dist/nitro/v3/module.mjs +4 -3
  91. package/dist/nitro/v3/module.mjs.map +1 -1
  92. package/dist/nitro/v3/plugin.d.mts +3 -1
  93. package/dist/nitro/v3/plugin.mjs +4 -5
  94. package/dist/nitro/v3/plugin.mjs.map +1 -1
  95. package/dist/nitro/v3/useLogger.d.mts +1 -1
  96. package/dist/nitro/v3/useLogger.mjs +1 -1
  97. package/dist/nitro/v3/useLogger.mjs.map +1 -1
  98. package/dist/{nitro-BRisWfGy.d.mts → nitro-CGGTUned.d.mts} +2 -2
  99. package/dist/nitro-CGGTUned.d.mts.map +1 -0
  100. package/dist/{nitro-Da8tEfJ3.mjs → nitro-D1pPm37T.mjs} +4 -9
  101. package/dist/nitro-D1pPm37T.mjs.map +1 -0
  102. package/dist/nuxt/module.d.mts +1 -1
  103. package/dist/nuxt/module.mjs +2 -5
  104. package/dist/nuxt/module.mjs.map +1 -1
  105. package/dist/parseError-BztqcPwZ.d.mts +7 -0
  106. package/dist/parseError-BztqcPwZ.d.mts.map +1 -0
  107. package/dist/pipeline.mjs +1 -1
  108. package/dist/{routes-BNbrnm14.mjs → routes-CE3_c-iZ.mjs} +2 -3
  109. package/dist/{routes-BNbrnm14.mjs.map → routes-CE3_c-iZ.mjs.map} +1 -1
  110. package/dist/runtime/client/log.d.mts +1 -1
  111. package/dist/runtime/client/log.d.mts.map +1 -1
  112. package/dist/runtime/client/log.mjs +4 -11
  113. package/dist/runtime/client/log.mjs.map +1 -1
  114. package/dist/runtime/client/plugin.mjs +1 -2
  115. package/dist/runtime/client/plugin.mjs.map +1 -1
  116. package/dist/runtime/server/routes/_evlog/ingest.post.mjs +1 -2
  117. package/dist/runtime/server/routes/_evlog/ingest.post.mjs.map +1 -1
  118. package/dist/runtime/server/useLogger.d.mts +2 -39
  119. package/dist/runtime/server/useLogger.mjs +1 -1
  120. package/dist/runtime/server/useLogger.mjs.map +1 -1
  121. package/dist/runtime/utils/parseError.d.mts +3 -7
  122. package/dist/runtime/utils/parseError.mjs +1 -1
  123. package/dist/{storage-CejtuV76.mjs → storage-CJBW5Vos.mjs} +4 -3
  124. package/dist/storage-CJBW5Vos.mjs.map +1 -0
  125. package/dist/sveltekit/index.d.mts +2 -2
  126. package/dist/sveltekit/index.mjs +5 -5
  127. package/dist/toolkit.d.mts +38 -0
  128. package/dist/toolkit.d.mts.map +1 -0
  129. package/dist/toolkit.mjs +5 -0
  130. package/dist/types-B8-kC2ME.d.mts +496 -0
  131. package/dist/types-B8-kC2ME.d.mts.map +1 -0
  132. package/dist/types.d.mts +2 -496
  133. package/dist/types.mjs +1 -1
  134. package/dist/useLogger-_Ec6mXoR.d.mts +39 -0
  135. package/dist/useLogger-_Ec6mXoR.d.mts.map +1 -0
  136. package/dist/utils.d.mts +18 -2
  137. package/dist/utils.d.mts.map +1 -1
  138. package/dist/utils.mjs +28 -2
  139. package/dist/utils.mjs.map +1 -1
  140. package/dist/workers.d.mts +1 -1
  141. package/dist/workers.mjs +1 -2
  142. package/dist/workers.mjs.map +1 -1
  143. package/package.json +68 -39
  144. package/dist/error.d.mts.map +0 -1
  145. package/dist/headers-CXOd5EyZ.mjs.map +0 -1
  146. package/dist/logger.d.mts.map +0 -1
  147. package/dist/middleware-BoVCgsfQ.d.mts +0 -36
  148. package/dist/middleware-BoVCgsfQ.d.mts.map +0 -1
  149. package/dist/nitro-BRisWfGy.d.mts.map +0 -1
  150. package/dist/nitro-Da8tEfJ3.mjs.map +0 -1
  151. package/dist/runtime/server/useLogger.d.mts.map +0 -1
  152. package/dist/runtime/utils/parseError.d.mts.map +0 -1
  153. package/dist/storage-CejtuV76.mjs.map +0 -1
  154. package/dist/types.d.mts.map +0 -1
package/dist/types.d.mts CHANGED
@@ -1,496 +1,2 @@
1
- //#region src/types.d.ts
2
- declare module 'nitropack/types' {
3
- interface NitroRuntimeHooks {
4
- /**
5
- * Tail sampling hook - called before emitting a log.
6
- * Set `ctx.shouldKeep = true` to force-keep the log regardless of head sampling.
7
- *
8
- * @example
9
- * ```ts
10
- * nitroApp.hooks.hook('evlog:emit:keep', (ctx) => {
11
- * if (ctx.context.user?.premium) {
12
- * ctx.shouldKeep = true
13
- * }
14
- * })
15
- * ```
16
- */
17
- 'evlog:emit:keep': (ctx: TailSamplingContext) => void | Promise<void>;
18
- /**
19
- * Enrichment hook - called after emit, before drain.
20
- * Use this to enrich the event with derived context (e.g. geo, user agent).
21
- *
22
- * @example
23
- * ```ts
24
- * nitroApp.hooks.hook('evlog:enrich', (ctx) => {
25
- * ctx.event.deploymentId = process.env.DEPLOYMENT_ID
26
- * })
27
- * ```
28
- */
29
- 'evlog:enrich': (ctx: EnrichContext) => void | Promise<void>;
30
- /**
31
- * Drain hook - called after emitting a log (fire-and-forget).
32
- * Use this to send logs to external services like Axiom, Loki, or custom endpoints.
33
- * Errors are logged but never block the request.
34
- *
35
- * @example
36
- * ```ts
37
- * nitroApp.hooks.hook('evlog:drain', async (ctx) => {
38
- * await fetch('https://api.axiom.co/v1/datasets/logs/ingest', {
39
- * method: 'POST',
40
- * headers: { Authorization: `Bearer ${process.env.AXIOM_TOKEN}` },
41
- * body: JSON.stringify([ctx.event])
42
- * })
43
- * })
44
- * ```
45
- */
46
- 'evlog:drain': (ctx: DrainContext) => void | Promise<void>;
47
- }
48
- }
49
- declare module 'nitro/types' {
50
- interface NitroRuntimeHooks {
51
- 'evlog:emit:keep': (ctx: TailSamplingContext) => void | Promise<void>;
52
- 'evlog:enrich': (ctx: EnrichContext) => void | Promise<void>;
53
- 'evlog:drain': (ctx: DrainContext) => void | Promise<void>;
54
- }
55
- }
56
- /**
57
- * Transport configuration for sending client logs to the server
58
- */
59
- interface TransportConfig {
60
- /**
61
- * Enable sending logs to the server API
62
- * @default false
63
- */
64
- enabled?: boolean;
65
- /**
66
- * API endpoint for log ingestion
67
- * @default '/api/_evlog/ingest'
68
- */
69
- endpoint?: string;
70
- }
71
- /**
72
- * Payload sent from client to server for log ingestion
73
- */
74
- interface IngestPayload {
75
- timestamp: string;
76
- level: 'info' | 'error' | 'warn' | 'debug';
77
- [key: string]: unknown;
78
- }
79
- /**
80
- * Sampling rates per log level (0-100 percentage)
81
- */
82
- interface SamplingRates {
83
- /** Percentage of info logs to keep (0-100). Default: 100 */
84
- info?: number;
85
- /** Percentage of warn logs to keep (0-100). Default: 100 */
86
- warn?: number;
87
- /** Percentage of debug logs to keep (0-100). Default: 100 */
88
- debug?: number;
89
- /** Percentage of error logs to keep (0-100). Default: 100 */
90
- error?: number;
91
- }
92
- /**
93
- * Tail sampling condition for forcing log retention based on request outcome.
94
- * All conditions use >= comparison (e.g., status: 400 means status >= 400).
95
- */
96
- interface TailSamplingCondition {
97
- /** Keep if HTTP status >= this value (e.g., 400 for all errors) */
98
- status?: number;
99
- /** Keep if request duration >= this value in milliseconds */
100
- duration?: number;
101
- /** Keep if path matches this glob pattern (e.g., '/api/critical/**') */
102
- path?: string;
103
- }
104
- /**
105
- * Context passed to tail sampling evaluation and hooks.
106
- * Contains request outcome information for sampling decisions.
107
- */
108
- interface TailSamplingContext {
109
- /** HTTP response status code */
110
- status?: number;
111
- /** Request duration in milliseconds (raw number) */
112
- duration?: number;
113
- /** Request path */
114
- path?: string;
115
- /** HTTP method */
116
- method?: string;
117
- /** Full accumulated context from the request logger */
118
- context: Record<string, unknown>;
119
- /**
120
- * Set to true in evlog:emit:keep hook to force keep this log.
121
- * Multiple hooks can set this - if any sets it to true, the log is kept.
122
- */
123
- shouldKeep?: boolean;
124
- }
125
- /**
126
- * Context passed to the evlog:enrich hook.
127
- * Called after emit, before drain.
128
- */
129
- interface EnrichContext {
130
- /** The emitted wide event (mutable). */
131
- event: WideEvent;
132
- /** Request metadata (if available) */
133
- request?: {
134
- method?: string;
135
- path: string;
136
- requestId?: string;
137
- };
138
- /** Safe HTTP request headers (sensitive headers filtered out) */
139
- headers?: Record<string, string>;
140
- /** Optional response metadata */
141
- response?: {
142
- status?: number;
143
- headers?: Record<string, string>;
144
- };
145
- }
146
- /**
147
- * Context passed to the evlog:drain hook.
148
- * Contains the complete wide event and request metadata for external transport.
149
- */
150
- interface DrainContext {
151
- /** The complete wide event to drain */
152
- event: WideEvent;
153
- /** Request metadata (if available) */
154
- request?: {
155
- method?: string;
156
- path?: string;
157
- requestId?: string;
158
- };
159
- /** HTTP headers from the original request (useful for correlation with external services) */
160
- headers?: Record<string, string>;
161
- }
162
- /**
163
- * Sampling configuration for filtering logs
164
- */
165
- interface SamplingConfig {
166
- /**
167
- * Sampling rates per log level (head sampling).
168
- * Values are percentages from 0 to 100.
169
- * Default: 100 for all levels (log everything).
170
- * Error defaults to 100 even if not specified.
171
- *
172
- * @example
173
- * ```ts
174
- * sampling: {
175
- * rates: {
176
- * info: 10, // Keep 10% of info logs
177
- * warn: 50, // Keep 50% of warning logs
178
- * debug: 5, // Keep 5% of debug logs
179
- * error: 100, // Always keep errors (default)
180
- * }
181
- * }
182
- * ```
183
- */
184
- rates?: SamplingRates;
185
- /**
186
- * Tail sampling conditions for forcing log retention (OR logic).
187
- * If ANY condition matches, the log is kept regardless of head sampling.
188
- * Use the `evlog:emit:keep` Nitro hook for custom conditions.
189
- *
190
- * @example
191
- * ```ts
192
- * sampling: {
193
- * rates: { info: 10 }, // Head sampling: keep 10% of info logs
194
- * keep: [
195
- * { status: 400 }, // Always keep if status >= 400
196
- * { duration: 1000 }, // Always keep if duration >= 1000ms
197
- * { path: '/api/critical/**' }, // Always keep critical paths
198
- * ]
199
- * }
200
- * ```
201
- */
202
- keep?: TailSamplingCondition[];
203
- }
204
- /**
205
- * Route-based service configuration
206
- */
207
- interface RouteConfig {
208
- /** Service name to use for routes matching this pattern */
209
- service: string;
210
- }
211
- /**
212
- * Environment context automatically included in every log event
213
- */
214
- interface EnvironmentContext {
215
- /** Service name (auto-detected from package.json or configurable) */
216
- service: string;
217
- /** Environment: 'development', 'production', 'test', etc. */
218
- environment: 'development' | 'production' | 'test' | string;
219
- /** Application version (auto-detected from package.json) */
220
- version?: string;
221
- /** Git commit hash (auto-detected from CI/CD env vars) */
222
- commitHash?: string;
223
- /** Deployment region (auto-detected from cloud provider env vars) */
224
- region?: string;
225
- }
226
- /**
227
- * Logger configuration options
228
- */
229
- interface LoggerConfig {
230
- /**
231
- * Enable or disable all logging globally.
232
- * When false, all emits, tagged logs, and request logger operations become no-ops.
233
- * @default true
234
- */
235
- enabled?: boolean;
236
- /** Environment context overrides */
237
- env?: Partial<EnvironmentContext>;
238
- /** Enable pretty printing (auto-detected: true in dev, false in prod) */
239
- pretty?: boolean;
240
- /** Sampling configuration for filtering logs */
241
- sampling?: SamplingConfig;
242
- /**
243
- * When pretty is disabled, emit JSON strings (default) or raw objects.
244
- * Set to false for environments like Cloudflare Workers that expect objects.
245
- * @default true
246
- */
247
- stringify?: boolean;
248
- /**
249
- * Drain callback called with every emitted event (fire-and-forget).
250
- * Use this to send logs to external services outside of Nitro.
251
- * Compatible with drain adapters (`createAxiomDrain()`) and pipeline-wrapped drains.
252
- *
253
- * @example
254
- * ```ts
255
- * import { initLogger, log } from 'evlog'
256
- * import { createAxiomDrain } from 'evlog/axiom'
257
- *
258
- * initLogger({
259
- * drain: createAxiomDrain({ dataset: 'logs', token: '...' }),
260
- * })
261
- *
262
- * log.info({ action: 'user_login' }) // automatically drained
263
- * ```
264
- *
265
- * @example
266
- * ```ts
267
- * // With pipeline for batching and retry
268
- * import { createDrainPipeline } from 'evlog/pipeline'
269
- *
270
- * const pipeline = createDrainPipeline({ batch: { size: 25 } })
271
- * const drain = pipeline(createAxiomDrain({ dataset: 'logs', token: '...' }))
272
- *
273
- * initLogger({ drain })
274
- *
275
- * // Flush on shutdown
276
- * process.on('beforeExit', () => drain.flush())
277
- * ```
278
- */
279
- drain?: (ctx: DrainContext) => void | Promise<void>;
280
- }
281
- /**
282
- * Base structure for all wide events
283
- */
284
- interface BaseWideEvent {
285
- timestamp: string;
286
- level: 'info' | 'error' | 'warn' | 'debug';
287
- service: string;
288
- environment: string;
289
- version?: string;
290
- commitHash?: string;
291
- region?: string;
292
- }
293
- /**
294
- * Wide event with arbitrary additional fields
295
- */
296
- type WideEvent = BaseWideEvent & Record<string, unknown>;
297
- /**
298
- * Recursively makes all properties optional.
299
- * Arrays are kept as-is (not deeply partial).
300
- */
301
- type DeepPartial<T> = T extends Array<unknown> ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
302
- /**
303
- * Fields set internally by the evlog plugin (status, service, etc.).
304
- * These are always accepted by `set()` regardless of the user-defined field type.
305
- */
306
- interface InternalFields {
307
- status?: number;
308
- service?: string;
309
- requestLogs?: RequestLogEntry[];
310
- }
311
- /**
312
- * Request-scoped log entry captured during a request lifecycle.
313
- */
314
- interface RequestLogEntry {
315
- level: 'info' | 'warn';
316
- message: string;
317
- timestamp: string;
318
- }
319
- /**
320
- * Resolved context type for logger methods.
321
- * User fields are deeply partial (matching deep merge behavior) with internal
322
- * field keys omitted to avoid intersection conflicts, then internal fields
323
- * are added back with their canonical types.
324
- */
325
- type FieldContext<T extends object = Record<string, unknown>> = DeepPartial<Omit<T, keyof InternalFields>> & InternalFields;
326
- /**
327
- * Request-scoped logger for building wide events
328
- *
329
- * @example
330
- * ```ts
331
- * const logger = useLogger(event)
332
- * logger.set({ user: { id: '123' } })
333
- * logger.set({ cart: { items: 3 } })
334
- * // emit() is called automatically by the plugin
335
- * ```
336
- *
337
- * @example
338
- * ```ts
339
- * // With typed fields for compile-time safety
340
- * interface MyFields {
341
- * user: { id: string; plan: string }
342
- * action: string
343
- * }
344
- * const logger = useLogger<MyFields>(event)
345
- * logger.set({ user: { id: '123', plan: 'pro' } }) // OK
346
- * logger.set({ user: { id: '123' } }) // OK (deep partial)
347
- * logger.set({ action: 'checkout' }) // OK
348
- * logger.set({ status: 200 }) // OK (internal field)
349
- * logger.set({ account: '...' }) // TS error
350
- * ```
351
- */
352
- interface RequestLogger<T extends object = Record<string, unknown>> {
353
- /**
354
- * Add context to the wide event (deep merge via defu)
355
- */
356
- set: (context: FieldContext<T>) => void;
357
- /**
358
- * Log an error and capture its details
359
- */
360
- error: (error: Error | string, context?: FieldContext<T>) => void;
361
- /**
362
- * Capture an informational message inside the request wide event.
363
- */
364
- info: (message: string, context?: FieldContext<T>) => void;
365
- /**
366
- * Capture a warning message inside the request wide event.
367
- */
368
- warn: (message: string, context?: FieldContext<T>) => void;
369
- /**
370
- * Emit the final wide event with all accumulated context.
371
- * Returns the emitted WideEvent, or null if the log was sampled out.
372
- */
373
- emit: (overrides?: FieldContext<T> & {
374
- _forceKeep?: boolean;
375
- }) => WideEvent | null;
376
- /**
377
- * Get the current accumulated context
378
- */
379
- getContext: () => FieldContext<T> & Record<string, unknown>;
380
- }
381
- /**
382
- * Log level type
383
- */
384
- type LogLevel = 'info' | 'error' | 'warn' | 'debug';
385
- /**
386
- * Simple logging API - as easy as console.log
387
- *
388
- * @example
389
- * ```ts
390
- * log.info('auth', 'User logged in')
391
- * log.error({ action: 'payment', error: 'failed' })
392
- * ```
393
- */
394
- interface Log {
395
- /**
396
- * Log an info message or wide event
397
- * @example log.info('auth', 'User logged in')
398
- * @example log.info({ action: 'login', userId: '123' })
399
- */
400
- info(tag: string, message: string): void;
401
- info(event: Record<string, unknown>): void;
402
- /**
403
- * Log an error message or wide event
404
- * @example log.error('payment', 'Payment failed')
405
- * @example log.error({ action: 'payment', error: 'declined' })
406
- */
407
- error(tag: string, message: string): void;
408
- error(event: Record<string, unknown>): void;
409
- /**
410
- * Log a warning message or wide event
411
- * @example log.warn('api', 'Rate limit approaching')
412
- * @example log.warn({ action: 'api', remaining: 10 })
413
- */
414
- warn(tag: string, message: string): void;
415
- warn(event: Record<string, unknown>): void;
416
- /**
417
- * Log a debug message or wide event
418
- * @example log.debug('cache', 'Cache miss')
419
- * @example log.debug({ action: 'cache', key: 'user_123' })
420
- */
421
- debug(tag: string, message: string): void;
422
- debug(event: Record<string, unknown>): void;
423
- }
424
- /**
425
- * Error options for creating structured errors
426
- */
427
- interface ErrorOptions {
428
- /** What actually happened */
429
- message: string;
430
- /** HTTP status code (default: 500) */
431
- status?: number;
432
- /** Why this error occurred */
433
- why?: string;
434
- /** How to fix this issue */
435
- fix?: string;
436
- /** Link to documentation or more information */
437
- link?: string;
438
- /** The original error that caused this */
439
- cause?: Error;
440
- }
441
- /**
442
- * Options for creating a request logger
443
- */
444
- interface RequestLoggerOptions {
445
- method?: string;
446
- path?: string;
447
- requestId?: string;
448
- }
449
- /**
450
- * H3 event context with evlog logger attached
451
- */
452
- interface H3EventContext {
453
- log?: RequestLogger;
454
- requestId?: string;
455
- status?: number;
456
- /** Internal: start time for duration calculation in tail sampling */
457
- _evlogStartTime?: number;
458
- /** Internal: flag to prevent double emission on errors */
459
- _evlogEmitted?: boolean;
460
- [key: string]: unknown;
461
- }
462
- /**
463
- * Server event type for Nitro/h3 handlers
464
- */
465
- interface ServerEvent {
466
- method: string;
467
- path: string;
468
- context: H3EventContext & {
469
- /** Cloudflare Workers context (available when deployed to CF Workers) */cloudflare?: {
470
- context: {
471
- waitUntil: (promise: Promise<unknown>) => void;
472
- };
473
- }; /** Vercel Edge context (available when deployed to Vercel Edge) */
474
- waitUntil?: (promise: Promise<unknown>) => void;
475
- };
476
- node?: {
477
- res?: {
478
- statusCode?: number;
479
- };
480
- };
481
- response?: Response;
482
- }
483
- /**
484
- * Parsed evlog error with all fields at the top level
485
- */
486
- interface ParsedError {
487
- message: string;
488
- status: number;
489
- why?: string;
490
- fix?: string;
491
- link?: string;
492
- raw: unknown;
493
- }
494
- //#endregion
495
- export { BaseWideEvent, DeepPartial, DrainContext, EnrichContext, EnvironmentContext, ErrorOptions, FieldContext, H3EventContext, IngestPayload, InternalFields, Log, LogLevel, LoggerConfig, ParsedError, RequestLogEntry, RequestLogger, RequestLoggerOptions, RouteConfig, SamplingConfig, SamplingRates, ServerEvent, TailSamplingCondition, TailSamplingContext, TransportConfig, WideEvent };
496
- //# sourceMappingURL=types.d.mts.map
1
+ import { C as TailSamplingContext, S as TailSamplingCondition, T as WideEvent, _ as RequestLoggerOptions, a as EnvironmentContext, b as SamplingRates, c as H3EventContext, d as Log, f as LogLevel, g as RequestLogger, h as RequestLogEntry, i as EnrichContext, l as IngestPayload, m as ParsedError, n as DeepPartial, o as ErrorOptions, p as LoggerConfig, r as DrainContext, s as FieldContext, t as BaseWideEvent, u as InternalFields, v as RouteConfig, w as TransportConfig, x as ServerEvent, y as SamplingConfig } from "./types-B8-kC2ME.mjs";
2
+ export { BaseWideEvent, DeepPartial, DrainContext, EnrichContext, EnvironmentContext, ErrorOptions, FieldContext, H3EventContext, IngestPayload, InternalFields, Log, LogLevel, LoggerConfig, ParsedError, RequestLogEntry, RequestLogger, RequestLoggerOptions, RouteConfig, SamplingConfig, SamplingRates, ServerEvent, TailSamplingCondition, TailSamplingContext, TransportConfig, WideEvent };
package/dist/types.mjs CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -0,0 +1,39 @@
1
+ import { g as RequestLogger, x as ServerEvent } from "./types-B8-kC2ME.mjs";
2
+
3
+ //#region src/runtime/server/useLogger.d.ts
4
+ /**
5
+ * Returns the request logger attached to the given server event.
6
+ *
7
+ * @param event - The current server event containing the context with the logger.
8
+ * @param service - Optional service name to override the default service.
9
+ * @returns The request-scoped logger.
10
+ * @throws Error if the logger is not initialized on the event context.
11
+ *
12
+ * @example
13
+ * export default defineEventHandler((event) => {
14
+ * const log = useLogger(event)
15
+ * log.set({ foo: 'bar' })
16
+ * // ...
17
+ * })
18
+ *
19
+ * @example
20
+ * // Override service name for specific routes
21
+ * export default defineEventHandler((event) => {
22
+ * const log = useLogger(event, 'payment-service')
23
+ * log.set({ foo: 'bar' })
24
+ * // ...
25
+ * })
26
+ *
27
+ * @example
28
+ * // Typed fields — must use explicit import for type checking to work
29
+ * import { useLogger } from 'evlog'
30
+ *
31
+ * interface MyFields { user: { id: string; plan: string } }
32
+ * const log = useLogger<MyFields>(event)
33
+ * log.set({ user: { id: '123', plan: 'pro' } }) // OK
34
+ * log.set({ foo: 'bar' }) // TS error
35
+ */
36
+ declare function useLogger<T extends object = Record<string, unknown>>(event: ServerEvent, service?: string): RequestLogger<T>;
37
+ //#endregion
38
+ export { useLogger as t };
39
+ //# sourceMappingURL=useLogger-_Ec6mXoR.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLogger-_Ec6mXoR.d.mts","names":[],"sources":["../src/runtime/server/useLogger.ts"],"mappings":";;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,SAAA,oBAA6B,MAAA,kBAAA,CAAyB,KAAA,EAAO,WAAA,EAAa,OAAA,YAAmB,aAAA,CAAc,CAAA"}
package/dist/utils.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { EnvironmentContext, LogLevel } from "./types.mjs";
1
+ import { a as EnvironmentContext, f as LogLevel } from "./types-B8-kC2ME.mjs";
2
2
 
3
3
  //#region src/utils.d.ts
4
4
  declare function formatDuration(ms: number): string;
@@ -21,6 +21,22 @@ declare const colors: {
21
21
  readonly gray: "\u001B[90m";
22
22
  };
23
23
  declare function getLevelColor(level: string): string;
24
+ declare const cssColors: {
25
+ readonly dim: "color: #6b7280";
26
+ readonly red: "color: #ef4444; font-weight: bold";
27
+ readonly green: "color: #22c55e";
28
+ readonly yellow: "color: #f59e0b; font-weight: bold";
29
+ readonly cyan: "color: #06b6d4; font-weight: bold";
30
+ readonly gray: "color: #6b7280; font-weight: bold";
31
+ readonly reset: "color: inherit; font-weight: normal";
32
+ };
33
+ declare function getCssLevelColor(level: string): string;
34
+ /**
35
+ * Escape `%` in strings interpolated into `console.log` format strings
36
+ * to prevent `%c`, `%s`, `%d` etc. in user data from being interpreted
37
+ * as formatting directives.
38
+ */
39
+ declare function escapeFormatString(str: string): string;
24
40
  /** Headers that should never be passed to hooks for security */
25
41
  declare const SENSITIVE_HEADERS: string[];
26
42
  declare function filterSafeHeaders(headers: Record<string, string>): Record<string, string>;
@@ -30,5 +46,5 @@ declare function filterSafeHeaders(headers: Record<string, string>): Record<stri
30
46
  */
31
47
  declare function matchesPattern(path: string, pattern: string): boolean;
32
48
  //#endregion
33
- export { SENSITIVE_HEADERS, colors, detectEnvironment, filterSafeHeaders, formatDuration, getConsoleMethod, getLevelColor, isClient, isDev, isServer, matchesPattern };
49
+ export { SENSITIVE_HEADERS, colors, cssColors, detectEnvironment, escapeFormatString, filterSafeHeaders, formatDuration, getConsoleMethod, getCssLevelColor, getLevelColor, isClient, isDev, isServer, matchesPattern };
34
50
  //# sourceMappingURL=utils.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.ts"],"mappings":";;;iBAEgB,cAAA,CAAe,EAAA;AAAA,iBAOf,QAAA,CAAA;AAAA,iBAIA,QAAA,CAAA;AAAA,iBAIA,KAAA,CAAA;AAAA,iBAUA,iBAAA,CAAA,GAAqB,OAAA,CAAQ,kBAAA;AAAA,iBAmB7B,gBAAA,CAAiB,KAAA,EAAO,QAAA,GAAW,QAAA;AAAA,cAItC,MAAA;EAAA;;;;;;;;;;;;iBAcG,aAAA,CAAc,KAAA;;cAgBjB,iBAAA;AAAA,iBASG,iBAAA,CAAkB,OAAA,EAAS,MAAA,mBAAyB,MAAA;;;;;iBAgBpD,cAAA,CAAe,IAAA,UAAc,OAAA"}
1
+ {"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.ts"],"mappings":";;;iBAEgB,cAAA,CAAe,EAAA;AAAA,iBAOf,QAAA,CAAA;AAAA,iBAIA,QAAA,CAAA;AAAA,iBAIA,KAAA,CAAA;AAAA,iBAUA,iBAAA,CAAA,GAAqB,OAAA,CAAQ,kBAAA;AAAA,iBAmB7B,gBAAA,CAAiB,KAAA,EAAO,QAAA,GAAW,QAAA;AAAA,cAItC,MAAA;EAAA;;;;;;;;;;;;iBAcG,aAAA,CAAc,KAAA;AAAA,cAejB,SAAA;EAAA;;;;;;;;iBAUG,gBAAA,CAAiB,KAAA;;;;;;iBAoBjB,kBAAA,CAAmB,GAAA;AA3DnC;AAAA,cAgEa,iBAAA;AAAA,iBASG,iBAAA,CAAkB,OAAA,EAAS,MAAA,mBAAyB,MAAA;;;;;iBAgBpD,cAAA,CAAe,IAAA,UAAc,OAAA"}
package/dist/utils.mjs CHANGED
@@ -50,6 +50,32 @@ function getLevelColor(level) {
50
50
  default: return colors.white;
51
51
  }
52
52
  }
53
+ const cssColors = {
54
+ dim: "color: #6b7280",
55
+ red: "color: #ef4444; font-weight: bold",
56
+ green: "color: #22c55e",
57
+ yellow: "color: #f59e0b; font-weight: bold",
58
+ cyan: "color: #06b6d4; font-weight: bold",
59
+ gray: "color: #6b7280; font-weight: bold",
60
+ reset: "color: inherit; font-weight: normal"
61
+ };
62
+ function getCssLevelColor(level) {
63
+ switch (level) {
64
+ case "error": return cssColors.red;
65
+ case "warn": return cssColors.yellow;
66
+ case "info": return cssColors.cyan;
67
+ case "debug": return cssColors.gray;
68
+ default: return cssColors.reset;
69
+ }
70
+ }
71
+ /**
72
+ * Escape `%` in strings interpolated into `console.log` format strings
73
+ * to prevent `%c`, `%s`, `%d` etc. in user data from being interpreted
74
+ * as formatting directives.
75
+ */
76
+ function escapeFormatString(str) {
77
+ return str.replace(/%/g, "%%");
78
+ }
53
79
  /** Headers that should never be passed to hooks for security */
54
80
  const SENSITIVE_HEADERS = [
55
81
  "authorization",
@@ -72,7 +98,7 @@ function matchesPattern(path, pattern) {
72
98
  const regexPattern = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/{{GLOBSTAR}}/g, ".*").replace(/\?/g, "[^/]");
73
99
  return new RegExp(`^${regexPattern}$`).test(path);
74
100
  }
75
-
76
101
  //#endregion
77
- export { SENSITIVE_HEADERS, colors, detectEnvironment, filterSafeHeaders, formatDuration, getConsoleMethod, getLevelColor, isClient, isDev, isServer, matchesPattern };
102
+ export { SENSITIVE_HEADERS, colors, cssColors, detectEnvironment, escapeFormatString, filterSafeHeaders, formatDuration, getConsoleMethod, getCssLevelColor, getLevelColor, isClient, isDev, isServer, matchesPattern };
103
+
78
104
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { EnvironmentContext, LogLevel } from './types'\n\nexport function formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${Math.round(ms)}ms`\n }\n return `${(ms / 1000).toFixed(2)}s`\n}\n\nexport function isServer(): boolean {\n return typeof window === 'undefined'\n}\n\nexport function isClient(): boolean {\n return typeof window !== 'undefined'\n}\n\nexport function isDev(): boolean {\n if (typeof process !== 'undefined') {\n return process.env.NODE_ENV !== 'production'\n }\n if (typeof window !== 'undefined') {\n return true\n }\n return false\n}\n\nexport function detectEnvironment(): Partial<EnvironmentContext> {\n const env = typeof process !== 'undefined' ? process.env : {}\n const defaultEnvironment = isDev() ? 'development' : 'production'\n\n return {\n environment: env.NODE_ENV || defaultEnvironment,\n service: env.SERVICE_NAME || 'app',\n version: env.APP_VERSION,\n commitHash: env.COMMIT_SHA\n || env.GITHUB_SHA\n || env.VERCEL_GIT_COMMIT_SHA\n || env.CF_PAGES_COMMIT_SHA,\n region: env.VERCEL_REGION\n || env.AWS_REGION\n || env.FLY_REGION\n || env.CF_REGION,\n }\n}\n\nexport function getConsoleMethod(level: LogLevel): LogLevel {\n return level\n}\n\nexport const colors = {\n reset: '\\x1B[0m',\n bold: '\\x1B[1m',\n dim: '\\x1B[2m',\n red: '\\x1B[31m',\n green: '\\x1B[32m',\n yellow: '\\x1B[33m',\n blue: '\\x1B[34m',\n magenta: '\\x1B[35m',\n cyan: '\\x1B[36m',\n white: '\\x1B[37m',\n gray: '\\x1B[90m',\n} as const\n\nexport function getLevelColor(level: string): string {\n switch (level) {\n case 'error':\n return colors.red\n case 'warn':\n return colors.yellow\n case 'info':\n return colors.cyan\n case 'debug':\n return colors.gray\n default:\n return colors.white\n }\n}\n\n/** Headers that should never be passed to hooks for security */\nexport const SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-auth-token',\n 'proxy-authorization',\n]\n\nexport function filterSafeHeaders(headers: Record<string, string>): Record<string, string> {\n const safeHeaders: Record<string, string> = {}\n\n for (const [key, value] of Object.entries(headers)) {\n if (!SENSITIVE_HEADERS.includes(key.toLowerCase())) {\n safeHeaders[key] = value\n }\n }\n\n return safeHeaders\n}\n\n/**\n * Match a path against a glob pattern.\n * Supports * (any chars except /) and ** (any chars including /).\n */\nexport function matchesPattern(path: string, pattern: string): boolean {\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&') // Escape special regex chars except * and ?\n .replace(/\\*\\*/g, '{{GLOBSTAR}}') // Temp placeholder for **\n .replace(/\\*/g, '[^/]*') // * matches anything except /\n .replace(/{{GLOBSTAR}}/g, '.*') // ** matches anything including /\n .replace(/\\?/g, '[^/]') // ? matches single char except /\n\n const regex = new RegExp(`^${regexPattern}$`)\n return regex.test(path)\n}\n"],"mappings":";AAEA,SAAgB,eAAe,IAAoB;AACjD,KAAI,KAAK,IACP,QAAO,GAAG,KAAK,MAAM,GAAG,CAAC;AAE3B,QAAO,IAAI,KAAK,KAAM,QAAQ,EAAE,CAAC;;AAGnC,SAAgB,WAAoB;AAClC,QAAO,OAAO,WAAW;;AAG3B,SAAgB,WAAoB;AAClC,QAAO,OAAO,WAAW;;AAG3B,SAAgB,QAAiB;AAC/B,KAAI,OAAO,YAAY,YACrB,QAAO,QAAQ,IAAI,aAAa;AAElC,KAAI,OAAO,WAAW,YACpB,QAAO;AAET,QAAO;;AAGT,SAAgB,oBAAiD;CAC/D,MAAM,MAAM,OAAO,YAAY,cAAc,QAAQ,MAAM,EAAE;CAC7D,MAAM,qBAAqB,OAAO,GAAG,gBAAgB;AAErD,QAAO;EACL,aAAa,IAAI,YAAY;EAC7B,SAAS,IAAI,gBAAgB;EAC7B,SAAS,IAAI;EACb,YAAY,IAAI,cACX,IAAI,cACJ,IAAI,yBACJ,IAAI;EACT,QAAQ,IAAI,iBACP,IAAI,cACJ,IAAI,cACJ,IAAI;EACV;;AAGH,SAAgB,iBAAiB,OAA2B;AAC1D,QAAO;;AAGT,MAAa,SAAS;CACpB,OAAO;CACP,MAAM;CACN,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,MAAM;CACP;AAED,SAAgB,cAAc,OAAuB;AACnD,SAAQ,OAAR;EACE,KAAK,QACH,QAAO,OAAO;EAChB,KAAK,OACH,QAAO,OAAO;EAChB,KAAK,OACH,QAAO,OAAO;EAChB,KAAK,QACH,QAAO,OAAO;EAChB,QACE,QAAO,OAAO;;;;AAKpB,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,kBAAkB,SAAyD;CACzF,MAAM,cAAsC,EAAE;AAE9C,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,CAChD,KAAI,CAAC,kBAAkB,SAAS,IAAI,aAAa,CAAC,CAChD,aAAY,OAAO;AAIvB,QAAO;;;;;;AAOT,SAAgB,eAAe,MAAc,SAA0B;CACrE,MAAM,eAAe,QAClB,QAAQ,qBAAqB,OAAO,CACpC,QAAQ,SAAS,eAAe,CAChC,QAAQ,OAAO,QAAQ,CACvB,QAAQ,iBAAiB,KAAK,CAC9B,QAAQ,OAAO,OAAO;AAGzB,QADc,IAAI,OAAO,IAAI,aAAa,GAAG,CAChC,KAAK,KAAK"}
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { EnvironmentContext, LogLevel } from './types'\n\nexport function formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${Math.round(ms)}ms`\n }\n return `${(ms / 1000).toFixed(2)}s`\n}\n\nexport function isServer(): boolean {\n return typeof window === 'undefined'\n}\n\nexport function isClient(): boolean {\n return typeof window !== 'undefined'\n}\n\nexport function isDev(): boolean {\n if (typeof process !== 'undefined') {\n return process.env.NODE_ENV !== 'production'\n }\n if (typeof window !== 'undefined') {\n return true\n }\n return false\n}\n\nexport function detectEnvironment(): Partial<EnvironmentContext> {\n const env = typeof process !== 'undefined' ? process.env : {}\n const defaultEnvironment = isDev() ? 'development' : 'production'\n\n return {\n environment: env.NODE_ENV || defaultEnvironment,\n service: env.SERVICE_NAME || 'app',\n version: env.APP_VERSION,\n commitHash: env.COMMIT_SHA\n || env.GITHUB_SHA\n || env.VERCEL_GIT_COMMIT_SHA\n || env.CF_PAGES_COMMIT_SHA,\n region: env.VERCEL_REGION\n || env.AWS_REGION\n || env.FLY_REGION\n || env.CF_REGION,\n }\n}\n\nexport function getConsoleMethod(level: LogLevel): LogLevel {\n return level\n}\n\nexport const colors = {\n reset: '\\x1B[0m',\n bold: '\\x1B[1m',\n dim: '\\x1B[2m',\n red: '\\x1B[31m',\n green: '\\x1B[32m',\n yellow: '\\x1B[33m',\n blue: '\\x1B[34m',\n magenta: '\\x1B[35m',\n cyan: '\\x1B[36m',\n white: '\\x1B[37m',\n gray: '\\x1B[90m',\n} as const\n\nexport function getLevelColor(level: string): string {\n switch (level) {\n case 'error':\n return colors.red\n case 'warn':\n return colors.yellow\n case 'info':\n return colors.cyan\n case 'debug':\n return colors.gray\n default:\n return colors.white\n }\n}\n\nexport const cssColors = {\n dim: 'color: #6b7280',\n red: 'color: #ef4444; font-weight: bold',\n green: 'color: #22c55e',\n yellow: 'color: #f59e0b; font-weight: bold',\n cyan: 'color: #06b6d4; font-weight: bold',\n gray: 'color: #6b7280; font-weight: bold',\n reset: 'color: inherit; font-weight: normal',\n} as const\n\nexport function getCssLevelColor(level: string): string {\n switch (level) {\n case 'error':\n return cssColors.red\n case 'warn':\n return cssColors.yellow\n case 'info':\n return cssColors.cyan\n case 'debug':\n return cssColors.gray\n default:\n return cssColors.reset\n }\n}\n\n/**\n * Escape `%` in strings interpolated into `console.log` format strings\n * to prevent `%c`, `%s`, `%d` etc. in user data from being interpreted\n * as formatting directives.\n */\nexport function escapeFormatString(str: string): string {\n return str.replace(/%/g, '%%')\n}\n\n/** Headers that should never be passed to hooks for security */\nexport const SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-auth-token',\n 'proxy-authorization',\n]\n\nexport function filterSafeHeaders(headers: Record<string, string>): Record<string, string> {\n const safeHeaders: Record<string, string> = {}\n\n for (const [key, value] of Object.entries(headers)) {\n if (!SENSITIVE_HEADERS.includes(key.toLowerCase())) {\n safeHeaders[key] = value\n }\n }\n\n return safeHeaders\n}\n\n/**\n * Match a path against a glob pattern.\n * Supports * (any chars except /) and ** (any chars including /).\n */\nexport function matchesPattern(path: string, pattern: string): boolean {\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&') // Escape special regex chars except * and ?\n .replace(/\\*\\*/g, '{{GLOBSTAR}}') // Temp placeholder for **\n .replace(/\\*/g, '[^/]*') // * matches anything except /\n .replace(/{{GLOBSTAR}}/g, '.*') // ** matches anything including /\n .replace(/\\?/g, '[^/]') // ? matches single char except /\n\n const regex = new RegExp(`^${regexPattern}$`)\n return regex.test(path)\n}\n"],"mappings":";AAEA,SAAgB,eAAe,IAAoB;AACjD,KAAI,KAAK,IACP,QAAO,GAAG,KAAK,MAAM,GAAG,CAAC;AAE3B,QAAO,IAAI,KAAK,KAAM,QAAQ,EAAE,CAAC;;AAGnC,SAAgB,WAAoB;AAClC,QAAO,OAAO,WAAW;;AAG3B,SAAgB,WAAoB;AAClC,QAAO,OAAO,WAAW;;AAG3B,SAAgB,QAAiB;AAC/B,KAAI,OAAO,YAAY,YACrB,QAAO,QAAQ,IAAI,aAAa;AAElC,KAAI,OAAO,WAAW,YACpB,QAAO;AAET,QAAO;;AAGT,SAAgB,oBAAiD;CAC/D,MAAM,MAAM,OAAO,YAAY,cAAc,QAAQ,MAAM,EAAE;CAC7D,MAAM,qBAAqB,OAAO,GAAG,gBAAgB;AAErD,QAAO;EACL,aAAa,IAAI,YAAY;EAC7B,SAAS,IAAI,gBAAgB;EAC7B,SAAS,IAAI;EACb,YAAY,IAAI,cACX,IAAI,cACJ,IAAI,yBACJ,IAAI;EACT,QAAQ,IAAI,iBACP,IAAI,cACJ,IAAI,cACJ,IAAI;EACV;;AAGH,SAAgB,iBAAiB,OAA2B;AAC1D,QAAO;;AAGT,MAAa,SAAS;CACpB,OAAO;CACP,MAAM;CACN,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,MAAM;CACP;AAED,SAAgB,cAAc,OAAuB;AACnD,SAAQ,OAAR;EACE,KAAK,QACH,QAAO,OAAO;EAChB,KAAK,OACH,QAAO,OAAO;EAChB,KAAK,OACH,QAAO,OAAO;EAChB,KAAK,QACH,QAAO,OAAO;EAChB,QACE,QAAO,OAAO;;;AAIpB,MAAa,YAAY;CACvB,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,MAAM;CACN,OAAO;CACR;AAED,SAAgB,iBAAiB,OAAuB;AACtD,SAAQ,OAAR;EACE,KAAK,QACH,QAAO,UAAU;EACnB,KAAK,OACH,QAAO,UAAU;EACnB,KAAK,OACH,QAAO,UAAU;EACnB,KAAK,QACH,QAAO,UAAU;EACnB,QACE,QAAO,UAAU;;;;;;;;AASvB,SAAgB,mBAAmB,KAAqB;AACtD,QAAO,IAAI,QAAQ,MAAM,KAAK;;;AAIhC,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,kBAAkB,SAAyD;CACzF,MAAM,cAAsC,EAAE;AAE9C,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,CAChD,KAAI,CAAC,kBAAkB,SAAS,IAAI,aAAa,CAAC,CAChD,aAAY,OAAO;AAIvB,QAAO;;;;;;AAOT,SAAgB,eAAe,MAAc,SAA0B;CACrE,MAAM,eAAe,QAClB,QAAQ,qBAAqB,OAAO,CACpC,QAAQ,SAAS,eAAe,CAChC,QAAQ,OAAO,QAAQ,CACvB,QAAQ,iBAAiB,KAAK,CAC9B,QAAQ,OAAO,OAAO;AAGzB,QADc,IAAI,OAAO,IAAI,aAAa,GAAG,CAChC,KAAK,KAAK"}
@@ -1,4 +1,4 @@
1
- import { LoggerConfig, RequestLogger } from "./types.mjs";
1
+ import { g as RequestLogger, p as LoggerConfig } from "./types-B8-kC2ME.mjs";
2
2
 
3
3
  //#region src/workers/index.d.ts
4
4
  /**
package/dist/workers.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import { createRequestLogger, initLogger } from "./logger.mjs";
2
-
3
2
  //#region src/workers/index.ts
4
3
  function isRecord(value) {
5
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -75,7 +74,7 @@ function createWorkersLogger(request, options = {}) {
75
74
  });
76
75
  return log;
77
76
  }
78
-
79
77
  //#endregion
80
78
  export { createWorkersLogger, initWorkersLogger };
79
+
81
80
  //# sourceMappingURL=workers.mjs.map