Logging Errors from a ManagedRuntime in Effect Typescript

How does one use the effect logger to log out an error or defect from a ManagedRuntime? https://effect.website/play/#adc8fe343388

import { Context, Effect, Layer, ManagedRuntime } from "effect"

class Random extends Context.Tag("MyRandomService")<
  Random,
  { readonly next: number }
>() {}

const FailLayer = Layer.sync(Random, () => {
  throw new Error("some error")
})

// How can I use Effect.log to log out the error channel or defect from a ManagedRuntime?
const managedRuntime = ManagedRuntime.make(FailLayer)

const program = Effect.void.pipe(Effect.tap(Effect.log("hello")))

managedRuntime.runPromiseExit(program)
Was this page helpful?