Design an asynchronous logger with formatting
Qube Research & TechnologiesSoftware Engineer · Technical ScreenLast updated
This question evaluates expertise in concurrent programming, lock-free MPMC queue usage, producer–consumer asynchronous logging, variadic formatting APIs, and robustness in shutdown/flush semantics and error handling.
Design and implement an asynchronous C++ logger that accepts variadic arguments with fmt-style format strings, uses a background thread to perform formatting and writing, and passes messages via a provided lock-free queue. Assume we do not optimize for heap usage or memory footprint. Specify the public API, the log event structure, the producer–consumer flow, and demonstrate shutdown/flush behavior and error handling.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.