Effect CommunityEC
Effect Community3y ago
47 replies
timolins

Introducing tapLog: A Shortcut for Logging in Effect

Hi folks! Is there a way to quickly log things, without messing up the return type? I found to Effect.tap(() => Effect.log()) too cumbersome to write.

For now, I ended up implementing tapLog as a shorthand:
const tapLog =
  <R, E, A>(text: string) =>
  (effect: Effect.Effect<R, E, A>): Effect.Effect<R, E, A> =>
    Effect.tap(effect, () => Effect.log(text));
Was this page helpful?