Hyperlinkv0.8.0-beta.28

Effect

Effect.logWarningconsteffect/Effect.ts:13836
(...message: ReadonlyArray<any>): Effect<void>

Logs one or more messages at the WARNING level.

Example (Logging warnings)

import { Effect } from "effect"

const program = Effect.gen(function*() {
  yield* Effect.logWarning("API rate limit approaching")
  yield* Effect.logWarning("Retries remaining:", 2, "Operation:", "fetchData")

  // Useful for non-critical issues
  const deprecated = true
  if (deprecated) {
    yield* Effect.logWarning("Using deprecated API endpoint")
  }
})

Effect.runPromise(program)
// Output:
// timestamp=2023-... level=WARN message="API rate limit approaching"
// timestamp=2023-... level=WARN message="Retries remaining: 2 Operation: fetchData"
// timestamp=2023-... level=WARN message="Using deprecated API endpoint"
logging
export const logWarning: (...message: ReadonlyArray<any>) => Effect<void> = internal.logWithLevel("Warn")