Best Practices for Logging Errors with Effect in TypeScript

hey guys, what is the best practice for logging an error, especially on the catchAll?
I am notice that Effect.log need to be used with yield* so currently trying to do it using something like
Effect.gen(function* () {
  // my program
}).pipe(
  Effect.catchAll((cause) =>
    Effect.gen(function* () {
      yield* Effect.log(cause)
      return createLoginResult({
        type: "error",
        cause,
      })
    }),
  ),
)

previously I tried
Effect.catchAll((cause) => {
  Effect.log(cause)
  return Effect.succeed(
    createLoginResult({
      type: "error",
      cause,
    }),
  )
}),

but does not work
Was this page helpful?