-
Notifications
You must be signed in to change notification settings - Fork 14
3. Logger
DK edited this page Sep 20, 2023
·
1 revision
Some macro style loggers with spdlog
backend.
// by default the log directory is current process path
// this can be manually overriden
#define LOG_PATH "logs\\"
#include "DKUtil/Logger.hpp"
DKUtil::Logger::Init(NameString, VersionString);
TRACE("trace {}", debugVal);
INFO("{} {} {} {}", a, b, c, d);
DEBUG("Important debug info that shows on debug build"sv);
WARN("Generate warnings in log");
ERROR("This will prompt for exit!");
FATAL("This will abort with message.");
ENABLE_DEBUG
// debug logs from here will be printed
DISABLE_DEBUG
// debug logs from here will be omitted
// or change log level manually
DKUtil::Logger::SetLevel(spdlog::level::level_enums);
For fmt syntax, refer to fmtlib syntax.