Default logger, levels, macros and named loggers.
Default logger, levels, macros and named loggers.
#include <memory>
int main() {
log->trace("Not shown: the level is Debug");
log->debug("Starting the engine, threads={}", 4);
log->info("Application started, v{}.{}", 1, 0);
log->warn("Low memory: {}MB left", 128);
log->error("File not found: {}", "config.json");
net->info("Connecting to {}:{}", "192.168.1.1", 8080);
net->warn("Timeout after {}ms", 5000);
return 0;
}
#define RST_LOG_INFO(...)
Definition LogRegistry.hpp:75
#define RST_LOG_WARN(...)
Definition LogRegistry.hpp:76
#define RST_LOG_ERROR(...)
Definition LogRegistry.hpp:77
static std::shared_ptr< Logger > init(std::string_view appName="app", LogLevel level=LogLevel::Info, bool toFile=false)
Quick setup: logs from level to the console, and to <appName>.log if toFile is true.
static std::shared_ptr< Logger > get(std::string_view name)
Logger named name, created on first use with the global sinks and level.