From 4d5da049b23086ab2e9f419e99551a4254e70c56 Mon Sep 17 00:00:00 2001 From: scuzqy <80660355+scuzqy@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:09:10 +0800 Subject: [PATCH] [easylog]if statement can be constexpr (#494) --- include/ylt/easylog.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ylt/easylog.hpp b/include/ylt/easylog.hpp index 348e9cbed..42df82b9d 100644 --- a/include/ylt/easylog.hpp +++ b/include/ylt/easylog.hpp @@ -213,7 +213,7 @@ inline void add_appender(std::function fn) { easylog::record_t(std::chrono::system_clock::now(), severity, \ GET_STRING(__FILE__, __LINE__)) \ .sprintf(fmt, __VA_ARGS__); \ - if (severity == easylog::Severity::CRITICAL) { \ + if constexpr (severity == easylog::Severity::CRITICAL) { \ easylog::flush(); \ std::exit(EXIT_FAILURE); \ } \ @@ -240,7 +240,7 @@ inline void add_appender(std::function fn) { easylog::record_t(std::chrono::system_clock::now(), severity, \ GET_STRING(__FILE__, __LINE__)) \ .format(prefix::format(format_str, __VA_ARGS__)); \ - if (severity == easylog::Severity::CRITICAL) { \ + if constexpr (severity == easylog::Severity::CRITICAL) { \ easylog::flush(); \ std::exit(EXIT_FAILURE); \ } \