@visulima/pail 4.0.2 → 4.1.1

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 (83) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE.md +346 -0
  3. package/README.md +17 -0
  4. package/dist/error.d.ts +69 -69
  5. package/dist/index.browser.d.ts +446 -445
  6. package/dist/index.browser.js +17 -17
  7. package/dist/index.server.d.ts +582 -582
  8. package/dist/index.server.js +27 -27
  9. package/dist/middleware/elysia.d.ts +44 -42
  10. package/dist/middleware/elysia.js +1 -1
  11. package/dist/middleware/express.d.ts +58 -59
  12. package/dist/middleware/express.js +1 -1
  13. package/dist/middleware/fastify.d.ts +55 -56
  14. package/dist/middleware/fastify.js +1 -1
  15. package/dist/middleware/hono.d.ts +56 -57
  16. package/dist/middleware/hono.js +1 -1
  17. package/dist/middleware/next/handler.d.ts +67 -68
  18. package/dist/middleware/next/handler.js +1 -1
  19. package/dist/middleware/sveltekit.d.ts +72 -73
  20. package/dist/middleware/sveltekit.js +1 -1
  21. package/dist/object-tree.d.ts +44 -44
  22. package/dist/packem_shared/AbstractJsonReporter-BpWRnN0L.js +1 -0
  23. package/dist/packem_shared/AbstractJsonReporter-DxZwImm5.js +1 -0
  24. package/dist/packem_shared/JsonReporter-9IcELa1m.js +2 -0
  25. package/dist/packem_shared/JsonReporter-Dd3kuj8X.js +1 -0
  26. package/dist/packem_shared/{PrettyReporter-DsHfKOU7.js → PrettyReporter-BUWNEg3_.js} +1 -1
  27. package/dist/packem_shared/{PrettyReporter-CcDdPQSt.js → PrettyReporter-DbgD89ck.js} +56 -30
  28. package/dist/packem_shared/abstract-json-reporter.d-B6NoO-hG.d.ts +61 -0
  29. package/dist/packem_shared/{abstract-pretty-reporter-DrLBJ6ds.js → abstract-pretty-reporter-CyfTvmKf.js} +41 -39
  30. package/dist/packem_shared/create-middleware-logger.d-BRkkBMlk.d.ts +47 -0
  31. package/dist/packem_shared/headers-DI58djdG.js +1 -0
  32. package/dist/packem_shared/index-CbkPnylC.js +1 -0
  33. package/dist/packem_shared/serializeError-52C4oiKx-CrnRcq9R.js +1 -0
  34. package/dist/packem_shared/storage-DVcJumyk.js +1 -0
  35. package/dist/packem_shared/types.d-4ge_rME4.d.ts +246 -0
  36. package/dist/packem_shared/{types.d-Cz9S7jZh.d.ts → types.d-BW8kAXUv.d.ts} +95 -95
  37. package/dist/packem_shared/types.d-DGHeA2iJ.d.ts +194 -0
  38. package/dist/packem_shared/useLogger-7p55yvvc.js +1 -0
  39. package/dist/packem_shared/wide-event.d-BMLastMR.d.ts +716 -0
  40. package/dist/packem_shared/write-stream-ytl_vhg_.js +1 -0
  41. package/dist/processor/caller/caller-processor.d.ts +32 -33
  42. package/dist/processor/environment-processor.d.ts +83 -84
  43. package/dist/processor/message-formatter-processor.d.ts +40 -45
  44. package/dist/processor/message-formatter-processor.js +1 -1
  45. package/dist/processor/opentelemetry-processor.d.ts +51 -52
  46. package/dist/processor/redact-processor.d.ts +57 -65
  47. package/dist/processor/sampling-processor.d.ts +90 -91
  48. package/dist/reporter/file/json-file-reporter.d.ts +77 -78
  49. package/dist/reporter/file/json-file-reporter.js +1 -1
  50. package/dist/reporter/http/abstract-http-reporter.d.ts +125 -121
  51. package/dist/reporter/http/abstract-http-reporter.js +2 -2
  52. package/dist/reporter/http/http-reporter.d.ts +33 -34
  53. package/dist/reporter/http/http-reporter.edge-light.d.ts +235 -230
  54. package/dist/reporter/http/http-reporter.edge-light.js +2 -2
  55. package/dist/reporter/json/index.browser.d.ts +62 -61
  56. package/dist/reporter/json/index.browser.js +1 -1
  57. package/dist/reporter/json/index.d.ts +36 -37
  58. package/dist/reporter/json/index.js +1 -1
  59. package/dist/reporter/pretty/index.browser.d.ts +57 -56
  60. package/dist/reporter/pretty/index.browser.js +1 -1
  61. package/dist/reporter/pretty/index.d.ts +133 -133
  62. package/dist/reporter/pretty/index.js +1 -1
  63. package/dist/reporter/simple/simple-reporter.server.d.ts +91 -90
  64. package/dist/reporter/simple/simple-reporter.server.js +7 -7
  65. package/dist/wide-event.d.ts +2 -3
  66. package/dist/wide-event.js +1 -1
  67. package/package.json +58 -37
  68. package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +0 -1
  69. package/dist/packem_shared/AbstractJsonReporter-w_bGGiD-.js +0 -1
  70. package/dist/packem_shared/JsonReporter-Sd_lJGS-.js +0 -2
  71. package/dist/packem_shared/JsonReporter-bmem9lcg.js +0 -1
  72. package/dist/packem_shared/abstract-json-reporter.d-wfESoEa-.d.ts +0 -62
  73. package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js +0 -25
  74. package/dist/packem_shared/create-middleware-logger.d-B-JmQ1Sl.d.ts +0 -47
  75. package/dist/packem_shared/headers-DH0H2s8W.js +0 -1
  76. package/dist/packem_shared/index-Q1764hvO.js +0 -1
  77. package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +0 -1
  78. package/dist/packem_shared/storage-DaXAlpiO.js +0 -1
  79. package/dist/packem_shared/types.d-bWnqHJKL.d.ts +0 -211
  80. package/dist/packem_shared/types.d-xxE3FOD3.d.ts +0 -229
  81. package/dist/packem_shared/useLogger-DB34CuU5.js +0 -1
  82. package/dist/packem_shared/wide-event.d-D3ATYpoK.d.ts +0 -717
  83. package/dist/packem_shared/write-stream-C7jxLxIT.js +0 -1
@@ -1,211 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { InteractiveManager } from '@visulima/interactive-manager';
3
- import { Primitive, LiteralUnion } from 'type-fest';
4
- /**
5
- * Global namespace for extending Pail's metadata interface.
6
- *
7
- * This global declaration allows other packages and applications to extend
8
- * the Meta interface with custom properties by declaring additional properties
9
- * in the VisulimaPail.CustomMeta interface.
10
- * @example
11
- * ```typescript
12
- * declare global {
13
- * namespace VisulimaPail {
14
- * interface CustomMeta<L> {
15
- * userId?: string;
16
- * requestId?: string;
17
- * }
18
- * }
19
- * }
20
- * ```
21
- */
22
- declare global {
23
- namespace VisulimaPail {
24
- interface CustomMeta<L> {}
25
- }
26
- }
27
- /**
28
- * Metadata object containing all information about a log entry.
29
- *
30
- * This interface defines the structure of metadata that is passed to reporters
31
- * and processors. It contains all the contextual information about a log message
32
- * including the message itself, timing information, error details, and more.
33
- * @template L - The log level type
34
- */
35
- interface Meta<L> extends VisulimaPail.CustomMeta<L> {
36
- badge: string | undefined;
37
- context: any[] | undefined;
38
- date: Date | string;
39
- error: Error | undefined;
40
- groups: string[];
41
- label: string | undefined;
42
- message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
43
- prefix: string | undefined;
44
- repeated?: number;
45
- scope: string[] | undefined;
46
- suffix: string | undefined;
47
- traceError: Error | undefined;
48
- type: {
49
- level: ExtendedRfc5424LogLevels | L;
50
- name: string;
51
- };
52
- }
53
- /**
54
- * Extended RFC 5424 Log Levels.
55
- *
56
- * Standard syslog severity levels as defined in RFC 5424, plus additional
57
- * levels commonly used in modern applications. Each level has a numeric
58
- * priority where lower numbers indicate higher severity.
59
- * @see https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
60
- */
61
- type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
62
- /**
63
- * Default Log Types.
64
- *
65
- * Predefined semantic log types that provide meaningful categorization
66
- * for different kinds of log messages. Each type has associated styling
67
- * and log level configuration.
68
- */
69
- type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "warning" | "watch";
70
- /**
71
- * Logger Function Type.
72
- *
73
- * Represents a logging function that can accept either a structured Message object
74
- * or multiple arguments in the traditional console.log style.
75
- */
76
- interface LoggerFunction {
77
- (message: Message): void;
78
- (...message: any[]): void;
79
- }
80
- /**
81
- * Logger Configuration.
82
- *
83
- * Configuration object that defines how a specific logger type should behave,
84
- * including its visual appearance and log level.
85
- * @template L - The log level type
86
- */
87
- interface LoggerConfiguration<L extends string> {
88
- badge?: string;
89
- color?: AnsiColors;
90
- label: string;
91
- logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
92
- }
93
- /**
94
- * Logger Types Configuration.
95
- *
96
- * A record mapping logger type names to their configurations.
97
- * @template T - Custom logger type names
98
- * @template L - Log level types
99
- */
100
- type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
101
- /**
102
- * Read-only Metadata.
103
- *
104
- * Immutable version of the Meta interface for use in reporters.
105
- * @template L - The log level type
106
- */
107
- type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
108
- /**
109
- * Reporter Interface.
110
- *
111
- * Base interface for all reporters. Reporters are responsible for
112
- * outputting log messages to various destinations (console, files, etc.).
113
- * @template L - The log level type
114
- */
115
- interface Reporter<L extends string> {
116
- log: (meta: ReadonlyMeta<L>) => void;
117
- }
118
- /**
119
- * Stream-Aware Reporter Interface.
120
- *
121
- * Extends Reporter with the ability to work with Node.js streams.
122
- * Used for server-side reporters that need to write to stdout/stderr.
123
- * @template L - The log level type
124
- */
125
- interface StreamAwareReporter<L extends string> extends Reporter<L> {
126
- /** Set the stderr stream for error output */
127
- setStderr: (stderr: NodeJS.WriteStream) => void;
128
- /** Set the stdout stream for standard output */
129
- setStdout: (stdout: NodeJS.WriteStream) => void;
130
- }
131
- /**
132
- * Logger Types Aware Reporter Interface.
133
- *
134
- * Extends Reporter with the ability to receive logger type configurations.
135
- * Allows reporters to customize their output based on logger types.
136
- * @template T - Custom logger type names
137
- * @template L - The log level type
138
- */
139
- interface LoggerTypesAwareReporter<T extends string, L extends string> extends Reporter<L> {
140
- /** Set the logger types configuration */
141
- setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
142
- }
143
- /**
144
- * Stringify-Aware Reporter Interface.
145
- *
146
- * Extends Reporter with the ability to receive a custom stringify function.
147
- * Useful for reporters that need to serialize complex objects.
148
- * @template L - The log level type
149
- */
150
- interface StringifyAwareReporter<L extends string> extends Reporter<L> {
151
- /** Set the stringify function for object serialization */
152
- setStringify: (stringify: any) => void;
153
- }
154
- /**
155
- * Interactive Stream Reporter Interface.
156
- *
157
- * Extends StreamAwareReporter with interactive capabilities for terminal UIs.
158
- * Supports features like progress bars and dynamic updates.
159
- * @template L - The log level type
160
- */
161
- interface InteractiveStreamReporter<L extends string> extends StreamAwareReporter<L> {
162
- /** Set the interactive manager for handling interactive output */
163
- setInteractiveManager: (manager?: InteractiveManager) => void;
164
- /** Enable or disable interactive mode */
165
- setIsInteractive: (interactive: boolean) => void;
166
- }
167
- /**
168
- * Processor Interface.
169
- *
170
- * Base interface for all processors. Processors can modify or enhance
171
- * log metadata before it reaches reporters.
172
- * @template L - The log level type
173
- */
174
- interface Processor<L extends string> {
175
- /** Process the log metadata */
176
- process: (meta: Meta<L>) => Meta<L>;
177
- }
178
- /**
179
- * Stringify-Aware Processor Interface.
180
- *
181
- * Extends Processor with the ability to receive a custom stringify function.
182
- * Useful for processors that need to serialize complex objects.
183
- * @template L - The log level type
184
- */
185
- interface StringifyAwareProcessor<L extends string> extends Processor<L> {
186
- /** Set the stringify function for object serialization */
187
- setStringify: (stringify: typeof JSON.stringify) => void;
188
- }
189
- interface ConstructorOptions<T extends string, L extends string> {
190
- disabled?: boolean;
191
- logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
192
- logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
193
- messages?: {
194
- timerEnd?: string;
195
- timerStart?: string;
196
- };
197
- processors?: Processor<L>[];
198
- rawReporter?: Reporter<L>;
199
- reporters?: Reporter<L>[];
200
- scope?: string[] | string;
201
- throttle?: number;
202
- throttleMin?: number;
203
- types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
204
- }
205
- type Message = {
206
- context?: any[];
207
- message: any;
208
- prefix?: string;
209
- suffix?: string;
210
- };
211
- export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E, InteractiveStreamReporter as I, LoggerFunction as L, Meta as M, Processor as P, ReadonlyMeta as R, StringifyAwareReporter as S, StreamAwareReporter as a, StringifyAwareProcessor as b, LoggerTypesConfig as c, Reporter as d, LoggerTypesAwareReporter as e };
@@ -1,229 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import '@visulima/interactive-manager';
3
- /**
4
- Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
5
-
6
- @category Type
7
- */
8
- type Primitive = null | undefined | string | number | boolean | symbol | bigint;
9
- /**
10
- Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
11
-
12
- Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
13
-
14
- This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
15
-
16
- @example
17
- ```
18
- import type {LiteralUnion} from 'type-fest';
19
-
20
- // Before
21
-
22
- type Pet = 'dog' | 'cat' | string;
23
-
24
- const petWithoutAutocomplete: Pet = '';
25
- // Start typing in your TypeScript-enabled IDE.
26
- // You **will not** get auto-completion for `dog` and `cat` literals.
27
-
28
- // After
29
-
30
- type Pet2 = LiteralUnion<'dog' | 'cat', string>;
31
-
32
- const petWithAutoComplete: Pet2 = '';
33
- // You **will** get auto-completion for `dog` and `cat` literals.
34
- ```
35
-
36
- @category Type
37
- */
38
- type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
39
- /**
40
- * Global namespace for extending Pail's metadata interface.
41
- *
42
- * This global declaration allows other packages and applications to extend
43
- * the Meta interface with custom properties by declaring additional properties
44
- * in the VisulimaPail.CustomMeta interface.
45
- * @example
46
- * ```typescript
47
- * declare global {
48
- * namespace VisulimaPail {
49
- * interface CustomMeta<L> {
50
- * userId?: string;
51
- * requestId?: string;
52
- * }
53
- * }
54
- * }
55
- * ```
56
- */
57
- declare global {
58
- namespace VisulimaPail {
59
- interface CustomMeta<L> {}
60
- }
61
- }
62
- /**
63
- * Metadata object containing all information about a log entry.
64
- *
65
- * This interface defines the structure of metadata that is passed to reporters
66
- * and processors. It contains all the contextual information about a log message
67
- * including the message itself, timing information, error details, and more.
68
- * @template L - The log level type
69
- */
70
- interface Meta<L> extends VisulimaPail.CustomMeta<L> {
71
- badge: string | undefined;
72
- context: any[] | undefined;
73
- date: Date | string;
74
- error: Error | undefined;
75
- groups: string[];
76
- label: string | undefined;
77
- message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
78
- prefix: string | undefined;
79
- repeated?: number;
80
- scope: string[] | undefined;
81
- suffix: string | undefined;
82
- traceError: Error | undefined;
83
- type: {
84
- level: ExtendedRfc5424LogLevels | L;
85
- name: string;
86
- };
87
- }
88
- /**
89
- * Extended RFC 5424 Log Levels.
90
- *
91
- * Standard syslog severity levels as defined in RFC 5424, plus additional
92
- * levels commonly used in modern applications. Each level has a numeric
93
- * priority where lower numbers indicate higher severity.
94
- * @see https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
95
- */
96
- type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
97
- /**
98
- * Default Log Types.
99
- *
100
- * Predefined semantic log types that provide meaningful categorization
101
- * for different kinds of log messages. Each type has associated styling
102
- * and log level configuration.
103
- */
104
- type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "warning" | "watch";
105
- /**
106
- * Logger Function Type.
107
- *
108
- * Represents a logging function that can accept either a structured Message object
109
- * or multiple arguments in the traditional console.log style.
110
- */
111
- interface LoggerFunction {
112
- (message: Message): void;
113
- (...message: any[]): void;
114
- }
115
- /**
116
- * Logger Configuration.
117
- *
118
- * Configuration object that defines how a specific logger type should behave,
119
- * including its visual appearance and log level.
120
- * @template L - The log level type
121
- */
122
- interface LoggerConfiguration<L extends string> {
123
- badge?: string;
124
- color?: AnsiColors;
125
- label: string;
126
- logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
127
- }
128
- /**
129
- * Logger Types Configuration.
130
- *
131
- * A record mapping logger type names to their configurations.
132
- * @template T - Custom logger type names
133
- * @template L - Log level types
134
- */
135
- type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
136
- /**
137
- * Default Logger Types Configuration.
138
- *
139
- * A complete mapping of all default log types to their full configurations.
140
- * @template L - Log level types
141
- */
142
- type DefaultLoggerTypes<L extends string = string> = Record<DefaultLogTypes, LoggerConfiguration<L>>;
143
- /**
144
- * Read-only Metadata.
145
- *
146
- * Immutable version of the Meta interface for use in reporters.
147
- * @template L - The log level type
148
- */
149
- type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
150
- /**
151
- * Reporter Interface.
152
- *
153
- * Base interface for all reporters. Reporters are responsible for
154
- * outputting log messages to various destinations (console, files, etc.).
155
- * @template L - The log level type
156
- */
157
- interface Reporter<L extends string> {
158
- log: (meta: ReadonlyMeta<L>) => void;
159
- }
160
- /**
161
- * Stream-Aware Reporter Interface.
162
- *
163
- * Extends Reporter with the ability to work with Node.js streams.
164
- * Used for server-side reporters that need to write to stdout/stderr.
165
- * @template L - The log level type
166
- */
167
- interface StreamAwareReporter<L extends string> extends Reporter<L> {
168
- /** Set the stderr stream for error output */
169
- setStderr: (stderr: NodeJS.WriteStream) => void;
170
- /** Set the stdout stream for standard output */
171
- setStdout: (stdout: NodeJS.WriteStream) => void;
172
- }
173
- /**
174
- * Logger Types Aware Reporter Interface.
175
- *
176
- * Extends Reporter with the ability to receive logger type configurations.
177
- * Allows reporters to customize their output based on logger types.
178
- * @template T - Custom logger type names
179
- * @template L - The log level type
180
- */
181
- interface LoggerTypesAwareReporter<T extends string, L extends string> extends Reporter<L> {
182
- /** Set the logger types configuration */
183
- setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
184
- }
185
- /**
186
- * Stringify-Aware Reporter Interface.
187
- *
188
- * Extends Reporter with the ability to receive a custom stringify function.
189
- * Useful for reporters that need to serialize complex objects.
190
- * @template L - The log level type
191
- */
192
- interface StringifyAwareReporter<L extends string> extends Reporter<L> {
193
- /** Set the stringify function for object serialization */
194
- setStringify: (stringify: any) => void;
195
- }
196
- /**
197
- * Processor Interface.
198
- *
199
- * Base interface for all processors. Processors can modify or enhance
200
- * log metadata before it reaches reporters.
201
- * @template L - The log level type
202
- */
203
- interface Processor<L extends string> {
204
- /** Process the log metadata */
205
- process: (meta: Meta<L>) => Meta<L>;
206
- }
207
- interface ConstructorOptions<T extends string, L extends string> {
208
- disabled?: boolean;
209
- logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
210
- logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
211
- messages?: {
212
- timerEnd?: string;
213
- timerStart?: string;
214
- };
215
- processors?: Processor<L>[];
216
- rawReporter?: Reporter<L>;
217
- reporters?: Reporter<L>[];
218
- scope?: string[] | string;
219
- throttle?: number;
220
- throttleMin?: number;
221
- types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
222
- }
223
- type Message = {
224
- context?: any[];
225
- message: any;
226
- prefix?: string;
227
- suffix?: string;
228
- };
229
- export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E, LiteralUnion as L, Meta as M, Processor as P, ReadonlyMeta as R, StringifyAwareReporter as S, LoggerTypesConfig as a, LoggerTypesAwareReporter as b, Reporter as c, LoggerFunction as d, DefaultLoggerTypes as e, LoggerConfiguration as f, StreamAwareReporter as g };
@@ -1 +0,0 @@
1
- import{createRequire as s}from"node:module";const i=s(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,n=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,t]=o.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return o.getBuiltinModule(e)}return i(e)},{AsyncLocalStorage:c}=n("node:async_hooks"),a=new c,u=()=>{const e=a.getStore();if(!e)throw new Error("[pail] useLogger() called outside of withPail() context. Wrap your route handler or server action with withPail().");return e};export{a as pailStorage,u as useLogger};