Hyperlinkv0.8.0-beta.28

Effect

Effect.logFatalconsteffect/Effect.ts:13805
(...message: ReadonlyArray<any>): Effect<void>

Logs one or more messages at the FATAL level.

Example (Logging fatal messages)

import { Effect } from "effect"

const program = Effect.gen(function*() {
  try {
    // Simulate a critical system failure
    throw new Error("System memory exhausted")
  } catch (error) {
    const errorMessage = error instanceof Error ? error.message : String(error)
    yield* Effect.logFatal("Critical system failure:", errorMessage)
    yield* Effect.logFatal("System shutting down")
  }
})

Effect.runPromise(program)
// Output:
// timestamp=2023-... level=FATAL message="Critical system failure: System memory exhausted"
// timestamp=2023-... level=FATAL message="System shutting down"
logging
export const logFatal: (...message: ReadonlyArray<any>) => Effect<void> = internal.logWithLevel("Fatal")