You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
slog-async drains will attempt to flush and join the writer thread on drop. Foundations holds a reference to the async drain in a static OnceCell so it's never dropped. This means that if a program logs and then exits the writer thread will not be joined and that log might not be written.
I'm thinking the least surprising solution is to just hook atexit and make sure it gets dropped with some changes to HARNESS to have sufficient interior mutability.
slog-async also offers AsyncGuard which when dropped will tell the async thread to finish and then join on it. That could be added to TelemetryDriver or something to make sure the logs get flushed when it goes out of scope. IMO given currently logger semantics (stored globally, may only be called once, etc) it's simpler to just flush it on exit.