g3log

Asynchronous crash-safe logger library for C++ applications

brewmacoslinux
Try with needOr install directly
Source

About

Asynchronous, 'crash safe', logger that is easy to use

Examples

set up basic logging in a C++ project$ g3log is a library, not a CLI tool. Include it in your CMakeLists.txt: find_package(g3log CONFIG REQUIRED) and link target_link_libraries(myapp g3log)
write log messages from C++ code$ LOG(INFO) << "Application started"; LOG(WARNING) << "Potential issue"; LOG(FATAL) << "Critical error";
configure log file output location$ auto worker = g3::LogWorker::createLogWorker(); auto handle = worker->addDefaultFileLogger("myapp", "./logs");
add custom log sink for remote logging$ auto sinkHandle = logWorker->addSink(std::make_unique<CustomSink>(), &CustomSink::receiveMessage);
catch and handle fatal crashes safely$ g3::installCrashHandler(); // Ensures logs are flushed before crash dump on Windows/Linux