Package: effect
Module: Effect
Adds log annotations to the current scope.
When to use
Use to attach log annotations that last until the current scope closes.
Details
This differs from annotateLogs, which only annotates a specific effect.
annotateLogsScoped updates annotations for the entire current Scope and
restores the previous annotations when the scope closes.
Example (Adding scoped log annotations)
import { Effect } from "effect"
const program = Effect.scoped(
Effect.gen(function*() {
yield* Effect.log("before")
yield* Effect.annotateLogsScoped({ requestId: "req-123" })
yield* Effect.log("inside scope")
})
)
Effect.runPromise(program)
See
annotateLogs for annotating one effectSignature
declare const annotateLogsScoped: { (key: string, value: unknown): Effect<void, never, Scope>; (values: Record<string, unknown>): Effect<void, never, Scope>; }
Since v3.1.0