diff options
Diffstat (limited to 'asl/logging/logging.hpp')
-rw-r--r-- | asl/logging/logging.hpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/asl/logging/logging.hpp b/asl/logging/logging.hpp index 9774927..6b8192b 100644 --- a/asl/logging/logging.hpp +++ b/asl/logging/logging.hpp @@ -87,9 +87,26 @@ void log(level l, const source_location& sl, string_view fmt, const Args&... arg } // namespace asl::log -// @Todo Compile-time configuration of logging - -#define ASL_LOG_DEBUG(...) ::asl::log::log(::asl::log::kDebug, ::asl::source_location{}, __VA_ARGS__) -#define ASL_LOG_INFO(...) ::asl::log::log(::asl::log::kInfo, ::asl::source_location{}, __VA_ARGS__) -#define ASL_LOG_WARNING(...) ::asl::log::log(::asl::log::kWarning, ::asl::source_location{}, __VA_ARGS__) -#define ASL_LOG_ERROR(...) ::asl::log::log(::asl::log::kError, ::asl::source_location{}, __VA_ARGS__) +#if !defined(ASL_LOG_LEVEL) || ASL_LOG_LEVEL >= 4 + #define ASL_LOG_DEBUG(...) ::asl::log::log(::asl::log::kDebug, ::asl::source_location{}, __VA_ARGS__) +#else + #define ASL_LOG_DEBUG(...) +#endif + +#if !defined(ASL_LOG_LEVEL) || ASL_LOG_LEVEL >= 3 + #define ASL_LOG_INFO(...) ::asl::log::log(::asl::log::kInfo, ::asl::source_location{}, __VA_ARGS__) +#else + #define ASL_LOG_DEBUG(...) +#endif + +#if !defined(ASL_LOG_LEVEL) || ASL_LOG_LEVEL >= 2 + #define ASL_LOG_WARNING(...) ::asl::log::log(::asl::log::kWarning, ::asl::source_location{}, __VA_ARGS__) +#else + #define ASL_LOG_DEBUG(...) +#endif + +#if !defined(ASL_LOG_LEVEL) || ASL_LOG_LEVEL >= 1 + #define ASL_LOG_ERROR(...) ::asl::log::log(::asl::log::kError, ::asl::source_location{}, __VA_ARGS__) +#else + #define ASL_LOG_DEBUG(...) +#endif |