effect 4.0.0-beta.37 → 4.0.0-beta.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +3 -2
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/Queue.d.ts +5 -2
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +5 -2
- package/dist/Queue.js.map +1 -1
- package/dist/References.d.ts +235 -224
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +234 -246
- package/dist/References.js.map +1 -1
- package/dist/Schedule.d.ts +6 -202
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +6 -71
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +6 -6
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +9 -13
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +5 -0
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +7 -2
- package/dist/SchemaParser.js.map +1 -1
- package/dist/Stream.d.ts +1 -1
- package/dist/Stream.js +1 -1
- package/dist/Struct.d.ts +7 -7
- package/dist/Struct.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/effect.js +1 -5
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/references.d.ts +2 -0
- package/dist/internal/references.d.ts.map +1 -0
- package/dist/internal/references.js +51 -0
- package/dist/internal/references.js.map +1 -0
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js +3 -3
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +2 -2
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +1 -1
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.js +2 -2
- package/dist/unstable/eventlog/SqlEventLogJournal.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +9 -8
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +36 -20
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +49 -18
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +186 -67
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +44 -29
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +5 -0
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +20 -2
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +2 -5
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +11 -7
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +6 -6
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ErrorReporter.ts +3 -2
- package/src/Queue.ts +5 -2
- package/src/References.ts +276 -285
- package/src/Schedule.ts +7 -212
- package/src/Schema.ts +8 -12
- package/src/SchemaAST.ts +6 -0
- package/src/SchemaParser.ts +7 -2
- package/src/Stream.ts +1 -1
- package/src/Struct.ts +7 -7
- package/src/index.ts +1 -1
- package/src/internal/effect.ts +14 -21
- package/src/internal/references.ts +72 -0
- package/src/unstable/cluster/EntityAddress.ts +1 -1
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/ShardId.ts +2 -2
- package/src/unstable/eventlog/EventJournal.ts +2 -2
- package/src/unstable/eventlog/EventLog.ts +1 -1
- package/src/unstable/eventlog/SqlEventLogJournal.ts +2 -2
- package/src/unstable/httpapi/HttpApiBuilder.ts +15 -9
- package/src/unstable/httpapi/HttpApiClient.ts +118 -55
- package/src/unstable/httpapi/HttpApiEndpoint.ts +164 -36
- package/src/unstable/httpapi/HttpApiSchema.ts +20 -2
- package/src/unstable/httpapi/OpenApi.ts +2 -6
- package/src/unstable/reactivity/AtomHttpApi.ts +22 -17
- package/src/unstable/schema/VariantSchema.ts +1 -1
package/dist/References.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { Logger } from "./Logger.ts";
|
|
1
2
|
import type { LogLevel, Severity } from "./LogLevel.ts";
|
|
2
3
|
import type { ReadonlyRecord } from "./Record.ts";
|
|
3
4
|
import { MaxOpsBeforeYield, PreventSchedulerYield } from "./Scheduler.ts";
|
|
4
|
-
import * as ServiceMap from "./ServiceMap.ts";
|
|
5
|
+
import type * as ServiceMap from "./ServiceMap.ts";
|
|
5
6
|
import { CurrentTraceLevel, DisablePropagation, MinimumTraceLevel, type SpanLink, Tracer } from "./Tracer.ts";
|
|
6
7
|
export {
|
|
7
8
|
/**
|
|
@@ -73,31 +74,94 @@ Tracer };
|
|
|
73
74
|
* @since 4.0.0
|
|
74
75
|
*/
|
|
75
76
|
export declare const CurrentConcurrency: ServiceMap.Reference<number | "unbounded">;
|
|
76
|
-
export {
|
|
77
77
|
/**
|
|
78
|
-
* Reference for
|
|
79
|
-
*
|
|
78
|
+
* Reference for managing log annotations that are automatically added to all log entries.
|
|
79
|
+
* These annotations provide contextual metadata that appears in every log message.
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* ```ts
|
|
83
|
-
* import { Effect, References
|
|
83
|
+
* import { Console, Effect, References } from "effect"
|
|
84
84
|
*
|
|
85
|
-
* const
|
|
86
|
-
* // Get current
|
|
87
|
-
* const current = yield* References.
|
|
88
|
-
* console.log(current) //
|
|
85
|
+
* const logAnnotationExample = Effect.gen(function*() {
|
|
86
|
+
* // Get current annotations (empty by default)
|
|
87
|
+
* const current = yield* References.CurrentLogAnnotations
|
|
88
|
+
* console.log(current) // {}
|
|
89
89
|
*
|
|
90
|
-
* //
|
|
90
|
+
* // Run with custom log annotations
|
|
91
91
|
* yield* Effect.provideService(
|
|
92
92
|
* Effect.gen(function*() {
|
|
93
|
-
* const
|
|
94
|
-
* console.log(
|
|
93
|
+
* const annotations = yield* References.CurrentLogAnnotations
|
|
94
|
+
* console.log(annotations) // { requestId: "req-123", userId: "user-456", version: "1.0.0" }
|
|
95
95
|
*
|
|
96
|
-
* //
|
|
97
|
-
* yield*
|
|
96
|
+
* // All log entries will include these annotations
|
|
97
|
+
* yield* Console.log("Starting operation")
|
|
98
|
+
* yield* Console.info("Processing data")
|
|
98
99
|
* }),
|
|
99
|
-
* References.
|
|
100
|
-
*
|
|
100
|
+
* References.CurrentLogAnnotations,
|
|
101
|
+
* {
|
|
102
|
+
* requestId: "req-123",
|
|
103
|
+
* userId: "user-456",
|
|
104
|
+
* version: "1.0.0"
|
|
105
|
+
* }
|
|
106
|
+
* )
|
|
107
|
+
*
|
|
108
|
+
* // Run with extended annotations
|
|
109
|
+
* yield* Effect.provideService(
|
|
110
|
+
* Effect.gen(function*() {
|
|
111
|
+
* const extended = yield* References.CurrentLogAnnotations
|
|
112
|
+
* console.log(extended) // { requestId: "req-123", userId: "user-456", version: "1.0.0", operation: "data-sync", timestamp: 1234567890 }
|
|
113
|
+
*
|
|
114
|
+
* yield* Console.log("Operation completed with extended context")
|
|
115
|
+
* }),
|
|
116
|
+
* References.CurrentLogAnnotations,
|
|
117
|
+
* {
|
|
118
|
+
* requestId: "req-123",
|
|
119
|
+
* userId: "user-456",
|
|
120
|
+
* version: "1.0.0",
|
|
121
|
+
* operation: "data-sync",
|
|
122
|
+
* timestamp: 1234567890
|
|
123
|
+
* }
|
|
124
|
+
* )
|
|
125
|
+
* })
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @since 4.0.0
|
|
129
|
+
* @category references
|
|
130
|
+
*/
|
|
131
|
+
export declare const CurrentLogAnnotations: ServiceMap.Reference<ReadonlyRecord<string, unknown>>;
|
|
132
|
+
/**
|
|
133
|
+
* Reference for controlling the current log level for dynamic filtering.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* import { Console, Effect, References } from "effect"
|
|
138
|
+
*
|
|
139
|
+
* const dynamicLogging = Effect.gen(function*() {
|
|
140
|
+
* // Get current log level (default is "Info")
|
|
141
|
+
* const current = yield* References.CurrentLogLevel
|
|
142
|
+
* console.log(current) // "Info"
|
|
143
|
+
*
|
|
144
|
+
* // Set log level to Debug for detailed logging
|
|
145
|
+
* yield* Effect.provideService(
|
|
146
|
+
* Effect.gen(function*() {
|
|
147
|
+
* const level = yield* References.CurrentLogLevel
|
|
148
|
+
* console.log(level) // "Debug"
|
|
149
|
+
* yield* Console.debug("This debug message will be shown")
|
|
150
|
+
* }),
|
|
151
|
+
* References.CurrentLogLevel,
|
|
152
|
+
* "Debug"
|
|
153
|
+
* )
|
|
154
|
+
*
|
|
155
|
+
* // Change to Error level to reduce noise
|
|
156
|
+
* yield* Effect.provideService(
|
|
157
|
+
* Effect.gen(function*() {
|
|
158
|
+
* const level = yield* References.CurrentLogLevel
|
|
159
|
+
* console.log(level) // "Error"
|
|
160
|
+
* yield* Console.info("This info message will be filtered out")
|
|
161
|
+
* yield* Console.error("This error message will be shown")
|
|
162
|
+
* }),
|
|
163
|
+
* References.CurrentLogLevel,
|
|
164
|
+
* "Error"
|
|
101
165
|
* )
|
|
102
166
|
* })
|
|
103
167
|
* ```
|
|
@@ -105,99 +169,157 @@ export {
|
|
|
105
169
|
* @category references
|
|
106
170
|
* @since 4.0.0
|
|
107
171
|
*/
|
|
108
|
-
|
|
172
|
+
export declare const CurrentLogLevel: ServiceMap.Reference<Severity>;
|
|
109
173
|
/**
|
|
174
|
+
* Reference for managing log spans that track the duration and hierarchy of operations.
|
|
175
|
+
* Each span represents a labeled time period for performance analysis and debugging.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* import { Console, Effect, References } from "effect"
|
|
180
|
+
*
|
|
181
|
+
* const logSpanExample = Effect.gen(function*() {
|
|
182
|
+
* // Get current spans (empty by default)
|
|
183
|
+
* const current = yield* References.CurrentLogSpans
|
|
184
|
+
* console.log(current.length) // 0
|
|
185
|
+
*
|
|
186
|
+
* // Add a log span manually
|
|
187
|
+
* const startTime = Date.now()
|
|
188
|
+
* yield* Effect.provideService(
|
|
189
|
+
* Effect.gen(function*() {
|
|
190
|
+
* // Simulate some work
|
|
191
|
+
* yield* Effect.sleep("100 millis")
|
|
192
|
+
* yield* Console.log("Database operation in progress")
|
|
193
|
+
*
|
|
194
|
+
* const spans = yield* References.CurrentLogSpans
|
|
195
|
+
* console.log("Active spans:", spans.map(([label]) => label)) // ["database-connection"]
|
|
196
|
+
* }),
|
|
197
|
+
* References.CurrentLogSpans,
|
|
198
|
+
* [["database-connection", startTime]]
|
|
199
|
+
* )
|
|
200
|
+
*
|
|
201
|
+
* // Add another span
|
|
202
|
+
* yield* Effect.provideService(
|
|
203
|
+
* Effect.gen(function*() {
|
|
204
|
+
* const spans = yield* References.CurrentLogSpans
|
|
205
|
+
* console.log("Active spans:", spans.map(([label]) => label)) // ["database-connection", "data-processing"]
|
|
206
|
+
*
|
|
207
|
+
* yield* Console.log("Multiple operations in progress")
|
|
208
|
+
* }),
|
|
209
|
+
* References.CurrentLogSpans,
|
|
210
|
+
* [
|
|
211
|
+
* ["database-connection", startTime],
|
|
212
|
+
* ["data-processing", Date.now()]
|
|
213
|
+
* ]
|
|
214
|
+
* )
|
|
215
|
+
*
|
|
216
|
+
* // Clear spans when operations complete
|
|
217
|
+
* yield* Effect.provideService(
|
|
218
|
+
* Effect.gen(function*() {
|
|
219
|
+
* const spans = yield* References.CurrentLogSpans
|
|
220
|
+
* console.log("Active spans:", spans.length) // 0
|
|
221
|
+
* }),
|
|
222
|
+
* References.CurrentLogSpans,
|
|
223
|
+
* []
|
|
224
|
+
* )
|
|
225
|
+
* })
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
110
228
|
* @since 4.0.0
|
|
111
229
|
* @category references
|
|
112
230
|
*/
|
|
113
|
-
export
|
|
114
|
-
readonly name: string;
|
|
115
|
-
readonly stack: () => string | undefined;
|
|
116
|
-
readonly parent: StackFrame | undefined;
|
|
117
|
-
}
|
|
231
|
+
export declare const CurrentLogSpans: ServiceMap.Reference<ReadonlyArray<[label: string, timestamp: number]>>;
|
|
118
232
|
/**
|
|
119
233
|
* @since 4.0.0
|
|
120
234
|
* @category references
|
|
121
235
|
*/
|
|
122
236
|
export declare const CurrentStackFrame: ServiceMap.Reference<StackFrame | undefined>;
|
|
123
237
|
/**
|
|
124
|
-
* Reference for
|
|
125
|
-
*
|
|
238
|
+
* Reference for setting the minimum log level threshold. Log entries below this
|
|
239
|
+
* level will be filtered out completely.
|
|
126
240
|
*
|
|
127
241
|
* @example
|
|
128
242
|
* ```ts
|
|
129
|
-
* import { Effect, References } from "effect"
|
|
243
|
+
* import { Console, Effect, References } from "effect"
|
|
130
244
|
*
|
|
131
|
-
* const
|
|
132
|
-
* //
|
|
133
|
-
* const current = yield* References.
|
|
134
|
-
* console.log(current) //
|
|
245
|
+
* const configureMinimumLogging = Effect.gen(function*() {
|
|
246
|
+
* // Get current minimum level (default is "Info")
|
|
247
|
+
* const current = yield* References.MinimumLogLevel
|
|
248
|
+
* console.log(current) // "Info"
|
|
135
249
|
*
|
|
136
|
-
* //
|
|
250
|
+
* // Set minimum level to Warn - Debug and Info will be filtered
|
|
137
251
|
* yield* Effect.provideService(
|
|
138
252
|
* Effect.gen(function*() {
|
|
139
|
-
* const
|
|
140
|
-
* console.log(
|
|
253
|
+
* const minLevel = yield* References.MinimumLogLevel
|
|
254
|
+
* console.log(minLevel) // "Warn"
|
|
141
255
|
*
|
|
142
|
-
* //
|
|
143
|
-
* yield*
|
|
256
|
+
* // These won't be processed at all
|
|
257
|
+
* yield* Console.debug("Debug message") // Filtered out
|
|
258
|
+
* yield* Console.info("Info message") // Filtered out
|
|
259
|
+
*
|
|
260
|
+
* // These will be processed
|
|
261
|
+
* yield* Console.warn("Warning message") // Shown
|
|
262
|
+
* yield* Console.error("Error message") // Shown
|
|
144
263
|
* }),
|
|
145
|
-
* References.
|
|
146
|
-
*
|
|
264
|
+
* References.MinimumLogLevel,
|
|
265
|
+
* "Warn"
|
|
147
266
|
* )
|
|
148
267
|
*
|
|
149
|
-
* //
|
|
268
|
+
* // Reset to default Info level
|
|
150
269
|
* yield* Effect.provideService(
|
|
151
270
|
* Effect.gen(function*() {
|
|
152
|
-
* const
|
|
153
|
-
* console.log(
|
|
271
|
+
* const minLevel = yield* References.MinimumLogLevel
|
|
272
|
+
* console.log(minLevel) // "Info"
|
|
154
273
|
*
|
|
155
|
-
* //
|
|
156
|
-
* yield*
|
|
274
|
+
* // Now info messages will be processed
|
|
275
|
+
* yield* Console.info("Info message") // Shown
|
|
157
276
|
* }),
|
|
158
|
-
* References.
|
|
159
|
-
*
|
|
277
|
+
* References.MinimumLogLevel,
|
|
278
|
+
* "Info"
|
|
160
279
|
* )
|
|
161
280
|
* })
|
|
162
281
|
* ```
|
|
163
282
|
*
|
|
164
|
-
* @since 4.0.0
|
|
165
283
|
* @category references
|
|
284
|
+
* @since 4.0.0
|
|
166
285
|
*/
|
|
167
|
-
export declare const
|
|
286
|
+
export declare const MinimumLogLevel: ServiceMap.Reference<LogLevel>;
|
|
168
287
|
/**
|
|
169
|
-
* Reference for controlling whether
|
|
170
|
-
*
|
|
171
|
-
* be set to zero).
|
|
288
|
+
* Reference for controlling whether tracing is enabled globally. When set to false,
|
|
289
|
+
* spans will not be registered with the tracer and tracing overhead is minimized.
|
|
172
290
|
*
|
|
173
291
|
* @example
|
|
174
292
|
* ```ts
|
|
175
293
|
* import { Effect, References } from "effect"
|
|
176
294
|
*
|
|
177
295
|
* const tracingControl = Effect.gen(function*() {
|
|
178
|
-
* // Check if
|
|
179
|
-
* const current = yield* References.
|
|
296
|
+
* // Check if tracing is enabled (default is true)
|
|
297
|
+
* const current = yield* References.TracerEnabled
|
|
180
298
|
* console.log(current) // true
|
|
181
299
|
*
|
|
182
|
-
* // Disable
|
|
300
|
+
* // Disable tracing globally
|
|
183
301
|
* yield* Effect.provideService(
|
|
184
302
|
* Effect.gen(function*() {
|
|
185
|
-
*
|
|
186
|
-
* const isEnabled = yield* References.TracerTimingEnabled
|
|
303
|
+
* const isEnabled = yield* References.TracerEnabled
|
|
187
304
|
* console.log(isEnabled) // false
|
|
305
|
+
*
|
|
306
|
+
* // Spans will not be traced in this context
|
|
307
|
+
* yield* Effect.log("This will not be traced")
|
|
188
308
|
* }),
|
|
189
|
-
* References.
|
|
309
|
+
* References.TracerEnabled,
|
|
190
310
|
* false
|
|
191
311
|
* )
|
|
192
312
|
*
|
|
193
|
-
* // Re-enable
|
|
313
|
+
* // Re-enable tracing
|
|
194
314
|
* yield* Effect.provideService(
|
|
195
315
|
* Effect.gen(function*() {
|
|
196
|
-
*
|
|
197
|
-
* const isEnabled = yield* References.TracerTimingEnabled
|
|
316
|
+
* const isEnabled = yield* References.TracerEnabled
|
|
198
317
|
* console.log(isEnabled) // true
|
|
318
|
+
*
|
|
319
|
+
* // All subsequent spans will be traced
|
|
320
|
+
* yield* Effect.log("This will be traced")
|
|
199
321
|
* }),
|
|
200
|
-
* References.
|
|
322
|
+
* References.TracerEnabled,
|
|
201
323
|
* true
|
|
202
324
|
* )
|
|
203
325
|
* })
|
|
@@ -206,7 +328,7 @@ export declare const TracerEnabled: ServiceMap.Reference<boolean>;
|
|
|
206
328
|
* @since 4.0.0
|
|
207
329
|
* @category references
|
|
208
330
|
*/
|
|
209
|
-
export declare const
|
|
331
|
+
export declare const TracerEnabled: ServiceMap.Reference<boolean>;
|
|
210
332
|
/**
|
|
211
333
|
* Reference for managing span annotations that are automatically added to all new spans.
|
|
212
334
|
* These annotations provide context and metadata that applies across multiple spans.
|
|
@@ -318,54 +440,41 @@ export declare const TracerSpanAnnotations: ServiceMap.Reference<ReadonlyRecord<
|
|
|
318
440
|
* @since 4.0.0
|
|
319
441
|
* @category references
|
|
320
442
|
*/
|
|
321
|
-
export declare const TracerSpanLinks: ServiceMap.Reference<
|
|
443
|
+
export declare const TracerSpanLinks: ServiceMap.Reference<ReadonlyArray<SpanLink>>;
|
|
322
444
|
/**
|
|
323
|
-
* Reference for
|
|
324
|
-
*
|
|
445
|
+
* Reference for controlling whether trace timing is enabled globally. When set
|
|
446
|
+
* to false, spans will not contain timing information (trace time will always
|
|
447
|
+
* be set to zero).
|
|
325
448
|
*
|
|
326
449
|
* @example
|
|
327
450
|
* ```ts
|
|
328
|
-
* import {
|
|
451
|
+
* import { Effect, References } from "effect"
|
|
329
452
|
*
|
|
330
|
-
* const
|
|
331
|
-
* //
|
|
332
|
-
* const current = yield* References.
|
|
333
|
-
* console.log(current) //
|
|
453
|
+
* const tracingControl = Effect.gen(function*() {
|
|
454
|
+
* // Check if trace timing is enabled (default is true)
|
|
455
|
+
* const current = yield* References.TracerTimingEnabled
|
|
456
|
+
* console.log(current) // true
|
|
334
457
|
*
|
|
335
|
-
* //
|
|
458
|
+
* // Disable trace timing globally
|
|
336
459
|
* yield* Effect.provideService(
|
|
337
460
|
* Effect.gen(function*() {
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
* // All log entries will include these annotations
|
|
342
|
-
* yield* Console.log("Starting operation")
|
|
343
|
-
* yield* Console.info("Processing data")
|
|
461
|
+
* // Spans will not having timing information in this context
|
|
462
|
+
* const isEnabled = yield* References.TracerTimingEnabled
|
|
463
|
+
* console.log(isEnabled) // false
|
|
344
464
|
* }),
|
|
345
|
-
* References.
|
|
346
|
-
*
|
|
347
|
-
* requestId: "req-123",
|
|
348
|
-
* userId: "user-456",
|
|
349
|
-
* version: "1.0.0"
|
|
350
|
-
* }
|
|
465
|
+
* References.TracerTimingEnabled,
|
|
466
|
+
* false
|
|
351
467
|
* )
|
|
352
468
|
*
|
|
353
|
-
* //
|
|
469
|
+
* // Re-enable trace timing
|
|
354
470
|
* yield* Effect.provideService(
|
|
355
471
|
* Effect.gen(function*() {
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
* yield* Console.log("Operation completed with extended context")
|
|
472
|
+
* // Spans will have timing information in this context
|
|
473
|
+
* const isEnabled = yield* References.TracerTimingEnabled
|
|
474
|
+
* console.log(isEnabled) // true
|
|
360
475
|
* }),
|
|
361
|
-
* References.
|
|
362
|
-
*
|
|
363
|
-
* requestId: "req-123",
|
|
364
|
-
* userId: "user-456",
|
|
365
|
-
* version: "1.0.0",
|
|
366
|
-
* operation: "data-sync",
|
|
367
|
-
* timestamp: 1234567890
|
|
368
|
-
* }
|
|
476
|
+
* References.TracerTimingEnabled,
|
|
477
|
+
* true
|
|
369
478
|
* )
|
|
370
479
|
* })
|
|
371
480
|
* ```
|
|
@@ -373,163 +482,65 @@ export declare const TracerSpanLinks: ServiceMap.Reference<readonly SpanLink[]>;
|
|
|
373
482
|
* @since 4.0.0
|
|
374
483
|
* @category references
|
|
375
484
|
*/
|
|
376
|
-
export declare const
|
|
485
|
+
export declare const TracerTimingEnabled: ServiceMap.Reference<boolean>;
|
|
377
486
|
/**
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* @example
|
|
381
|
-
* ```ts
|
|
382
|
-
* import { Console, Effect, References } from "effect"
|
|
383
|
-
*
|
|
384
|
-
* const dynamicLogging = Effect.gen(function*() {
|
|
385
|
-
* // Get current log level (default is "Info")
|
|
386
|
-
* const current = yield* References.CurrentLogLevel
|
|
387
|
-
* console.log(current) // "Info"
|
|
388
|
-
*
|
|
389
|
-
* // Set log level to Debug for detailed logging
|
|
390
|
-
* yield* Effect.provideService(
|
|
391
|
-
* Effect.gen(function*() {
|
|
392
|
-
* const level = yield* References.CurrentLogLevel
|
|
393
|
-
* console.log(level) // "Debug"
|
|
394
|
-
* yield* Console.debug("This debug message will be shown")
|
|
395
|
-
* }),
|
|
396
|
-
* References.CurrentLogLevel,
|
|
397
|
-
* "Debug"
|
|
398
|
-
* )
|
|
399
|
-
*
|
|
400
|
-
* // Change to Error level to reduce noise
|
|
401
|
-
* yield* Effect.provideService(
|
|
402
|
-
* Effect.gen(function*() {
|
|
403
|
-
* const level = yield* References.CurrentLogLevel
|
|
404
|
-
* console.log(level) // "Error"
|
|
405
|
-
* yield* Console.info("This info message will be filtered out")
|
|
406
|
-
* yield* Console.error("This error message will be shown")
|
|
407
|
-
* }),
|
|
408
|
-
* References.CurrentLogLevel,
|
|
409
|
-
* "Error"
|
|
410
|
-
* )
|
|
411
|
-
* })
|
|
412
|
-
* ```
|
|
487
|
+
* The log level for unhandled errors. This reference allows you to set the log
|
|
488
|
+
* level for unhandled errors that occur during Effect execution.
|
|
413
489
|
*
|
|
414
490
|
* @category references
|
|
415
491
|
* @since 4.0.0
|
|
416
492
|
*/
|
|
417
|
-
export declare const
|
|
493
|
+
export declare const UnhandledLogLevel: ServiceMap.Reference<Severity | undefined>;
|
|
418
494
|
/**
|
|
419
|
-
* Reference for setting the minimum log level threshold. Log entries below this
|
|
420
|
-
* level will be filtered out completely.
|
|
421
|
-
*
|
|
422
|
-
* @example
|
|
423
|
-
* ```ts
|
|
424
|
-
* import { Console, Effect, References } from "effect"
|
|
425
|
-
*
|
|
426
|
-
* const configureMinimumLogging = Effect.gen(function*() {
|
|
427
|
-
* // Get current minimum level (default is "Info")
|
|
428
|
-
* const current = yield* References.MinimumLogLevel
|
|
429
|
-
* console.log(current) // "Info"
|
|
430
|
-
*
|
|
431
|
-
* // Set minimum level to Warn - Debug and Info will be filtered
|
|
432
|
-
* yield* Effect.provideService(
|
|
433
|
-
* Effect.gen(function*() {
|
|
434
|
-
* const minLevel = yield* References.MinimumLogLevel
|
|
435
|
-
* console.log(minLevel) // "Warn"
|
|
436
|
-
*
|
|
437
|
-
* // These won't be processed at all
|
|
438
|
-
* yield* Console.debug("Debug message") // Filtered out
|
|
439
|
-
* yield* Console.info("Info message") // Filtered out
|
|
440
|
-
*
|
|
441
|
-
* // These will be processed
|
|
442
|
-
* yield* Console.warn("Warning message") // Shown
|
|
443
|
-
* yield* Console.error("Error message") // Shown
|
|
444
|
-
* }),
|
|
445
|
-
* References.MinimumLogLevel,
|
|
446
|
-
* "Warn"
|
|
447
|
-
* )
|
|
448
|
-
*
|
|
449
|
-
* // Reset to default Info level
|
|
450
|
-
* yield* Effect.provideService(
|
|
451
|
-
* Effect.gen(function*() {
|
|
452
|
-
* const minLevel = yield* References.MinimumLogLevel
|
|
453
|
-
* console.log(minLevel) // "Info"
|
|
454
|
-
*
|
|
455
|
-
* // Now info messages will be processed
|
|
456
|
-
* yield* Console.info("Info message") // Shown
|
|
457
|
-
* }),
|
|
458
|
-
* References.MinimumLogLevel,
|
|
459
|
-
* "Info"
|
|
460
|
-
* )
|
|
461
|
-
* })
|
|
462
|
-
* ```
|
|
463
|
-
*
|
|
464
|
-
* @category references
|
|
465
495
|
* @since 4.0.0
|
|
496
|
+
* @category references
|
|
466
497
|
*/
|
|
467
|
-
export
|
|
498
|
+
export interface StackFrame {
|
|
499
|
+
readonly name: string;
|
|
500
|
+
readonly stack: () => string | undefined;
|
|
501
|
+
readonly parent: StackFrame | undefined;
|
|
502
|
+
}
|
|
468
503
|
/**
|
|
469
|
-
*
|
|
470
|
-
* level for unhandled errors that occur during Effect execution.
|
|
471
|
-
*
|
|
504
|
+
* @since 4.0.0
|
|
472
505
|
* @category references
|
|
506
|
+
*/
|
|
507
|
+
export declare const CurrentLoggers: ServiceMap.Reference<ReadonlySet<Logger<unknown, any>>>;
|
|
508
|
+
/**
|
|
473
509
|
* @since 4.0.0
|
|
510
|
+
* @category references
|
|
474
511
|
*/
|
|
475
|
-
export declare const
|
|
512
|
+
export declare const LogToStderr: ServiceMap.Reference<boolean>;
|
|
513
|
+
export {
|
|
476
514
|
/**
|
|
477
|
-
* Reference for
|
|
478
|
-
*
|
|
515
|
+
* Reference for the current scheduler implementation used by the Effect runtime.
|
|
516
|
+
* Controls how Effects are scheduled and executed.
|
|
479
517
|
*
|
|
480
518
|
* @example
|
|
481
519
|
* ```ts
|
|
482
|
-
* import {
|
|
483
|
-
*
|
|
484
|
-
* const logSpanExample = Effect.gen(function*() {
|
|
485
|
-
* // Get current spans (empty by default)
|
|
486
|
-
* const current = yield* References.CurrentLogSpans
|
|
487
|
-
* console.log(current.length) // 0
|
|
488
|
-
*
|
|
489
|
-
* // Add a log span manually
|
|
490
|
-
* const startTime = Date.now()
|
|
491
|
-
* yield* Effect.provideService(
|
|
492
|
-
* Effect.gen(function*() {
|
|
493
|
-
* // Simulate some work
|
|
494
|
-
* yield* Effect.sleep("100 millis")
|
|
495
|
-
* yield* Console.log("Database operation in progress")
|
|
520
|
+
* import { Effect, References, Scheduler } from "effect"
|
|
496
521
|
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* [["database-connection", startTime]]
|
|
502
|
-
* )
|
|
522
|
+
* const customScheduling = Effect.gen(function*() {
|
|
523
|
+
* // Get current scheduler (default is MixedScheduler)
|
|
524
|
+
* const current = yield* References.Scheduler
|
|
525
|
+
* console.log(current) // MixedScheduler instance
|
|
503
526
|
*
|
|
504
|
-
* //
|
|
527
|
+
* // Use a custom scheduler
|
|
505
528
|
* yield* Effect.provideService(
|
|
506
529
|
* Effect.gen(function*() {
|
|
507
|
-
* const
|
|
508
|
-
* console.log(
|
|
509
|
-
*
|
|
510
|
-
* yield* Console.log("Multiple operations in progress")
|
|
511
|
-
* }),
|
|
512
|
-
* References.CurrentLogSpans,
|
|
513
|
-
* [
|
|
514
|
-
* ["database-connection", startTime],
|
|
515
|
-
* ["data-processing", Date.now()]
|
|
516
|
-
* ]
|
|
517
|
-
* )
|
|
530
|
+
* const scheduler = yield* References.Scheduler
|
|
531
|
+
* console.log(scheduler) // Custom scheduler instance
|
|
518
532
|
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
* Effect.gen(function*() {
|
|
522
|
-
* const spans = yield* References.CurrentLogSpans
|
|
523
|
-
* console.log("Active spans:", spans.length) // 0
|
|
533
|
+
* // Effects will use the custom scheduler in this context
|
|
534
|
+
* yield* Effect.log("Using custom scheduler")
|
|
524
535
|
* }),
|
|
525
|
-
* References.
|
|
526
|
-
*
|
|
536
|
+
* References.Scheduler,
|
|
537
|
+
* new Scheduler.MixedScheduler()
|
|
527
538
|
* )
|
|
528
539
|
* })
|
|
529
540
|
* ```
|
|
530
541
|
*
|
|
531
|
-
* @since 4.0.0
|
|
532
542
|
* @category references
|
|
543
|
+
* @since 4.0.0
|
|
533
544
|
*/
|
|
534
|
-
|
|
545
|
+
Scheduler } from "./Scheduler.ts";
|
|
535
546
|
//# sourceMappingURL=References.d.ts.map
|
package/dist/References.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"References.d.ts","sourceRoot":"","sources":["../src/References.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"References.d.ts","sourceRoot":"","sources":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