Closed Maaarcocr closed 2 years ago
You can configure the console with a different output, this is unrelated to async.
See https://github.com/socketry/console-output-datadog/blob/main/lib/console/output/datadog/wrapper.rb for an example of how to amend logs. The output can either be a wrapper or a final destination, but for that I'd suggest you use the structured JSON formatter which is enabled automatically if the output is not a TTY.
Currently we log when an error is thrown in a task https://github.com/socketry/async/blob/809025c576a14317e40dd9e7e9584aabe2feb01c/lib/async/task.rb#L236 but there is no way to allow people to customise the kind of reporting that they want to do whenever an error is thrown.
For example, in my use case I'd like to use report these errors to something like Sentry and log them with a custom logger we have internally.
We could default to the current behaviour but also allow to pass a custom reporter somehow.