Global.For_async_shutdownUsed internally by other Async libraries.
There are two locations in Async, Async_command and Async_unix.Shutdown.shutdown_on_unhandled_exn, that have logic to catch unhandled exceptions and log them before exiting. Normally, they write these shutdown logs to stderr, but sometimes it's desirable to additionally write to select log outputs.
log_error is used by the two locations to log to these outputs at shutdown. register_error_output_name allows downstream libraries to opt their outputs into shutdown logging.
Async_command wraps its command's main function in a try_with, and calls log_error on error.
shutdown_on_unhandled_exn, which is usually used with programs that directly call Scheduler.go, catches exceptions with Monitor.detach_and_iter_errors; caught exceptions are sent to a mutable hook that Async_log.assign_top_level_logs sets with Shutdown.set_shutdown_on_unhandled_exn_logger.
val register_error_output_name : Base.String.t -> unitval log_error :
?time:Core.Time_float.t ->
?tags:(string * string) list ->
('a, unit, string, unit) Core.format4 ->
'a