From ef89c146f6ef3f0091ce2f4736cbda2dd7cf84a0 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 12 Sep 2022 23:38:47 +0200 Subject: enable json log file (#164) * Include source location on ZEN_ERROR and ZEN_CRITICAL * Use proper logging for sentry init status * format file logger as json if .json extension is given * changelog --- zencore/include/zencore/logging.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'zencore/include') diff --git a/zencore/include/zencore/logging.h b/zencore/include/zencore/logging.h index 7c2deeed7..45dbd8c56 100644 --- a/zencore/include/zencore/logging.h +++ b/zencore/include/zencore/logging.h @@ -129,18 +129,18 @@ struct LogCategory Log().warn(fmtstr##sv, ##__VA_ARGS__); \ } while (false) -#define ZEN_ERROR(fmtstr, ...) \ - do \ - { \ - using namespace std::literals; \ - Log().error(fmtstr##sv, ##__VA_ARGS__); \ +#define ZEN_ERROR(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, spdlog::level::err, fmtstr##sv, ##__VA_ARGS__); \ } while (false) -#define ZEN_CRITICAL(fmtstr, ...) \ - do \ - { \ - using namespace std::literals; \ - Log().critical(fmtstr##sv, ##__VA_ARGS__); \ +#define ZEN_CRITICAL(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, spdlog::level::critical, fmtstr##sv, ##__VA_ARGS__); \ } while (false) #define ZEN_CONSOLE(fmtstr, ...) \ -- cgit v1.2.3