From 23f7ecc6b92c246ab0bf39de3eb1c1b556ca2f1c Mon Sep 17 00:00:00 2001 From: scuzqy Date: Sat, 11 Nov 2023 13:33:03 +0800 Subject: [PATCH] [easylog]if statement can be constexpr --- 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); \ } \