Hi everybody,
I am working on a wrapper for the Seq
logger for Julia
(see WIP project)
Using the REST API for posting raw events , it is possible to post log events to the Seq
logging server.
My current implementation sends a POST request after every log event (i.e. @debug
, @info
, @warn
, or @error
).
The request takes some time to finish, therefoe, I’d like to run these requests as a background task.
Currently, I use the following approach
Threads.@spawn begin
HTTP.request("POST", url, header, event)
end
which spawns a new task without waiting for the result. Performance-wise this works quite well, but it is hacky since I don’t wait for a potential error message if the POST request fails.
Is it possible to run this post request as a proper background task without blocking the execution of the other code but still receiving the return value of the request?