denoland / std

The Deno Standard Library
https://jsr.io/@std
MIT License
3.22k stars 621 forks source link

logging in `@std/log` should be async #6186

Open justinmchase opened 1 week ago

justinmchase commented 1 week ago

Is your feature request related to a problem? Please describe.

I want to make a logger that pushes logs into a network api but I don't see how its possible with this api.

Describe the solution you'd like

The BaseLogger.log method would need to be async. All methods to log would be promise based.

await logger.info("for example");

Describe alternatives you've considered

Implementing a completely parallel logging system.

kt3k commented 4 days ago

I want to make a logger that pushes logs into a network api but I don't see how its possible with this api.

You can handle logs asynchronously in the handler implementation. You don't need to return the promise of network requests.