From fa55b5e9299bd31e31d8ea6e5772800008b1433e Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 21 Jul 2023 22:45:23 -0400 Subject: [PATCH] update cmake logging config and README.md --- CMakeLists.txt | 14 +++++++------- README.md | 18 +++++++++++++++--- include/blt/config.h.in | 14 +++++++------- include/blt/std/logging.h | 15 ++++++++------- 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e56d29d..fcbf4fd 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,13 @@ option(BUILD_STD "Build the BLT standard utilities." ON) option(BUILD_PROFILING "Build the BLT profiler extension" ON) option(BUILD_NBT "Build the BLT NBT + eNBT extension" ON) option(BUILD_TESTS "Build the BLT test set" OFF) -option(BLT_ENABLE_LOGGING "Enable blt::logging (all macros and will safely disable logging function!)" ON) -option(BLT_ENABLE_TRACE "Enable blt::logging BLT_TRACE macro" ON) -option(BLT_ENABLE_DEBUG "Enable blt::logging BLT_DEBUG macro" ON) -option(BLT_ENABLE_INFO "Enable blt::logging BLT_INFO macro" ON) -option(BLT_ENABLE_WARN "Enable blt::logging BLT_WARN macro" ON) -option(BLT_ENABLE_ERROR "Enable blt::logging BLT_ERROR macro" ON) -option(BLT_ENABLE_FATAL "Enable blt::logging BLT_FATAL macro" ON) +option(BLT_DISABLE_LOGGING "Disable blt::logging (all macros and will safely disable logging function!)" OFF) +option(BLT_DISABLE_TRACE "Disable blt::logging BLT_TRACE macro" OFF) +option(BLT_DISABLE_DEBUG "Disable blt::logging BLT_DEBUG macro" OFF) +option(BLT_DISABLE_INFO "Disable blt::logging BLT_INFO macro" OFF) +option(BLT_DISABLE_WARN "Disable blt::logging BLT_WARN macro" OFF) +option(BLT_DISABLE_ERROR "Disable blt::logging BLT_ERROR macro" OFF) +option(BLT_DISABLE_FATAL "Disable blt::logging BLT_FATAL macro" OFF) configure_file(include/blt/config.h.in config/blt/config.h @ONLY) diff --git a/README.md b/README.md index 5b16ba2..aeb6a03 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,22 @@ -# **BLT v0.2a** +# **BLT v0.6.0a** +A common utilities library I find useful ![Icon](icon_large.png) -### A common utilties library of missing stl features. (and more!) +--- -# **Features** +# Specialties +## blt::logging.v2 +Found in the header file `include/std/logging.h`, blt::logging is a fast and simple +single header logging library which can be used independently of BLT. Just include +the header file anywhere in your project and in ONE cpp file define `#define BLT_LOGGING_IMPLEMENTATION`. +If you are using BLT as a CMake library (as you should!) this is done for you. +- ### Compile Time Config + - Using CMake + - +--- + +# **Features / Examples** - ## Data Structures - Queue / Stack - faster than std::queue / std::stack diff --git a/include/blt/config.h.in b/include/blt/config.h.in index 79d71d2..3baaff1 100755 --- a/include/blt/config.h.in +++ b/include/blt/config.h.in @@ -2,12 +2,12 @@ #define BLT_CONFIG_H #cmakedefine ZLIB_FOUND -#cmakedefine BLT_ENABLE_LOGGING -#cmakedefine BLT_ENABLE_TRACE -#cmakedefine BLT_ENABLE_DEBUG -#cmakedefine BLT_ENABLE_INFO -#cmakedefine BLT_ENABLE_WARN -#cmakedefine BLT_ENABLE_ERROR -#cmakedefine BLT_ENABLE_FATAL +#cmakedefine BLT_DISABLE_LOGGING +#cmakedefine BLT_DISABLE_TRACE +#cmakedefine BLT_DISABLE_DEBUG +#cmakedefine BLT_DISABLE_INFO +#cmakedefine BLT_DISABLE_WARN +#cmakedefine BLT_DISABLE_ERROR +#cmakedefine BLT_DISABLE_FATAL #endif // BLT_CONFIG_H \ No newline at end of file diff --git a/include/blt/std/logging.h b/include/blt/std/logging.h index 1ccb7b6..0a2fb14 100755 --- a/include/blt/std/logging.h +++ b/include/blt/std/logging.h @@ -615,8 +615,9 @@ namespace blt::logging { #endif -#if !defined(BLT_ENABLE_LOGGING) || defined(BLT_DISABLE_LOGGING) +#ifdef BLT_DISABLE_LOGGING #define BLT_LOG(format, level, ...) + #define BLT_LOG_STREAM(level) #define BLT_TRACE(format, ...) #define BLT_DEBUG(format, ...) #define BLT_INFO(format, ...) @@ -626,7 +627,7 @@ namespace blt::logging { #else #define BLT_LOG(format, level, ...) log(format, level, __FILE__, __LINE__, ##__VA_ARGS__) #define BLT_LOG_STREAM(level) blt::logging::logger{level, __FILE__, __LINE__} - #ifndef BLT_ENABLE_TRACE + #ifdef BLT_DISABLE_TRACE #define BLT_TRACE(format, ...) #define BLT_TRACE0_STREAM blt::logging::empty_logger{} #define BLT_TRACE1_STREAM blt::logging::empty_logger{} @@ -642,7 +643,7 @@ namespace blt::logging { #define BLT_TRACE_STREAM BLT_LOG_STREAM(blt::logging::log_level::TRACE) #endif - #ifndef BLT_ENABLE_DEBUG + #ifdef BLT_DISABLE_DEBUG #define BLT_DEBUG(format, ...) #define BLT_DEBUG_STREAM blt::logging::empty_logger{} #else @@ -650,7 +651,7 @@ namespace blt::logging { #define BLT_DEBUG_STREAM BLT_LOG_STREAM(blt::logging::log_level::DEBUG) #endif - #ifndef BLT_ENABLE_INFO + #ifdef BLT_DISABLE_INFO #define BLT_INFO(format, ...) #define BLT_INFO_STREAM blt::logging::empty_logger{} #else @@ -658,7 +659,7 @@ namespace blt::logging { #define BLT_INFO_STREAM BLT_LOG_STREAM(blt::logging::log_level::INFO) #endif - #ifndef BLT_ENABLE_WARN + #ifdef BLT_DISABLE_WARN #define BLT_WARN(format, ...) #define BLT_WARN_STREAM blt::logging::empty_logger{} #else @@ -666,7 +667,7 @@ namespace blt::logging { #define BLT_WARN_STREAM BLT_LOG_STREAM(blt::logging::log_level::WARN) #endif - #ifndef BLT_ENABLE_ERROR + #ifdef BLT_DISABLE_ERROR #define BLT_ERROR(format, ...) #define BLT_ERROR_STREAM blt::logging::empty_logger{} #else @@ -674,7 +675,7 @@ namespace blt::logging { #define BLT_ERROR_STREAM BLT_LOG_STREAM(blt::logging::log_level::ERROR) #endif - #ifndef BLT_ENABLE_FATAL + #ifdef BLT_DISABLE_FATAL #define BLT_FATAL(format, ...) #define BLT_FATAL_STREAM blt::logging::empty_logger{} #else