Skip to content

runEffectWithLogging

runEffectWithLogging<A, E>(effect, logging): Promise<A>

Defined in: src/Runtime.ts:224

Run an Effect asynchronously with optional logging configuration.

  • Applies Logger.pretty in both cases
  • When logging is enabled, sets minimum log level to Debug (shows all logs)
  • When logging is disabled, uses default log level (hides Debug messages)
  • On failure, extracts the error and cleans stack traces

Type Parameters

A

A

E

E

Parameters

effect

Effect<A, E>

logging

boolean

Returns

Promise<A>

Example

import { Effect } from 'effect';
import * as Midday from '@no-witness-labs/midday-sdk';
const myEffect = Effect.gen(function* () {
yield* Effect.logDebug('Starting...');
return 42;
});
// With logging enabled
await Midday.Runtime.runEffectWithLogging(myEffect, true);
// With logging disabled (silent)
await Midday.Runtime.runEffectWithLogging(myEffect, false);

Since

0.3.0