effect-io-ai

Package: effect
Module: Console

Console.time

Starts a scoped timer for label and automatically ends it when the Effect scope is finalized.

Example (Timing scoped work)

import { Console, Effect } from "effect"

const program = Effect.gen(function*() {
  yield* Effect.scoped(
    Effect.gen(function*() {
      yield* Console.time("operation-timer")
      yield* Effect.sleep("1 second")
      yield* Console.log("Operation completed")
      // Timer ends automatically when scope closes
    })
  )
})

Signature

declare const time: (label?: string | undefined) => Effect.Effect<void, never, Scope>

Source

Since v2.0.0