An asynchronous, crash-safe C++14 logger with intuitive API, design-by-contract checks, and custom sink support.
G3log is an asynchronous logging library for C++ that ensures log safety during application crashes. It provides an intuitive API for logging and design-by-contract checks, making it ideal for systems where log integrity is critical. The library handles fatal events gracefully, flushing all logs before shutdown to prevent data loss.
C++ developers building performance-critical or safety-sensitive applications, such as embedded systems, servers, or real-time software, who need reliable and crash-safe logging.
Developers choose G3log for its combination of low overhead, crash safety, and extensibility without external dependencies, offering a robust alternative to other C++ loggers with a focus on worst-case latency stability.
G3log is an asynchronous, "crash safe", logger that is easy to use with default logging sinks or you can add your own. G3log is made with plain C++14 (C++11 support up to release 1.3.2) with no external libraries (except gtest used for unit tests). G3log is made to be cross-platform, currently running on OSX, Windows and several Linux distros. See Readme below for details of usage.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Handles fatal events and signals like SIGSEVG, flushing all logs before shutdown to prevent data loss, as detailed in the fatal handling section.
Asynchronous design minimizes impact on main application with average call overhead around ~2 us and stable worst-case latency, per performance benchmarks.
Offers both streaming (LOG) and printf-style (LOGF) syntax with conditional logging, making integration straightforward for various coding styles.
Supports custom sinks and includes third-party options for rotation, syslog, and colored output via the g3sinks repository, allowing tailored logging backends.
Initialization requires manual creation of LogWorker and logger sinks, which is more verbose compared to header-only or single-include loggers, as seen in the log instantiation example.
Core library lacks advanced features like log rotation or syslog support, forcing reliance on external sinks from g3sinks for common needs, increasing dependency management.
Logs are written in the background, introducing a delay before disk persistence, which may not suit applications needing immediate log visibility for debugging.