(key: string, value: unknown): Effect<void, never, Scope>
(values: Record<string, unknown>): Effect<void, never, Scope>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)export const const annotateLogsScoped: {
(key: string, value: unknown): Effect<
void,
never,
Scope
>
(values: Record<string, unknown>): Effect<
void,
never,
Scope
>
}
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)
annotateLogsScoped: {
(key: stringkey: string, value: unknownvalue: unknown): interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<void, never, Scope>
(values: Record<string, unknown>values: type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<string, unknown>): interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<void, never, Scope>
} = import internalinternal.const annotateLogsScoped: {
(key: string, value: unknown): Effect.Effect<
void,
never,
Scope.Scope
>
(
values: Record<string, unknown>
): Effect.Effect<void, never, Scope.Scope>
}
annotateLogsScoped