Capturing Effect Logs for Success/Failure Analysis in TypeScript

Hi,
I want to capture all logs that were produced by effect.
That's needed because I want to see all logs statements with successful/failed result of the effect execution result.
It's not convenient to see logs in AWS Cloud Watch every time effect get's failed to understand what was the reason of failed effect.
That's why I decided to go this way

That's how I capture logs:
                const live = 
                  Logger.replace(
                    Logger.defaultLogger,
                    Logger.make(({ message, date, logLevel, cause }) => 
                      actionLogs.push({
                        message,
                        cause,
                        time: date.toISOString(),
                        level: logLevel.label
                      })
                    )
                  )


I use Effect.logError in that supervised effect but I don't see the cause of error produced by Effect.logError(new Error("Some error"))

{
"_id": "Exit",
"_tag": "Failure",
"cause": {
"_id": "Cause",
"_tag": "Fail",
"failure": {
"cause": {},
"logs": [],
"_tag": "@efkit/shared.ActionError"
}
}
}
Was this page helpful?