use the genereated_definitions.hpp

This commit is contained in:
Kjell Hedstrom 2015-07-22 13:28:10 -06:00
parent 5c7c289069
commit d09ca7787d
4 changed files with 19 additions and 24 deletions

View File

@ -9,6 +9,14 @@
# =================================================================== # ===================================================================
# PLEASE NOTE THAT:
# the following definitions can through options be added
# to the auto generated file src/g3log/generated_definitions.hpp
# add_definitions(-DG3_DYNAMIC_LOGGING)
# add_definitions(-DCHANGE_G3LOG_DEBUG_TO_DBUG)
# add_definitions(-DDISABLE_FATAL_SIGNALHANDLING)
# add_definitions(-DDISABLE_VECTORED_EXCEPTIONHANDLING)
# add_definitions(-DDEBUG_BREAK_AT_FATAL_SIGNAL)
@ -23,9 +31,8 @@ option (USE_DYNAMIC_LOGGING_LEVELS
"Turn ON/OFF log levels. An disabled level will not push logs of that level to the sink. By default dynamic logging is disabled" OFF) "Turn ON/OFF log levels. An disabled level will not push logs of that level to the sink. By default dynamic logging is disabled" OFF)
IF(USE_DYNAMIC_LOGGING_LEVELS) IF(USE_DYNAMIC_LOGGING_LEVELS)
LIST(APPEND G3_DEFINITIONS G3_DYNAMIC_LOGGING) LIST(APPEND G3_DEFINITIONS G3_DYNAMIC_LOGGING)
add_definitions(-DG3_DYNAMIC_LOGGING)
MESSAGE("-DUSE_DYNAMIC_LOGGING_LEVELS=ON") MESSAGE("-DUSE_DYNAMIC_LOGGING_LEVELS=ON")
MESSAGE("\tDynamic logging levels can be turned on. Make sure to have [#define G3_DYNAMIC_LOGGING 1] in your source code") MESSAGE("\tDynamic logging levels is used")
MESSAGE("\tUse [g3::setLogLevel(LEVEL boolean)] to enable/disable logging on specified levels\n\n") MESSAGE("\tUse [g3::setLogLevel(LEVEL boolean)] to enable/disable logging on specified levels\n\n")
ELSE() ELSE()
MESSAGE("-DUSE_DYNAMIC_LOGGING_LEVELS=OFF") MESSAGE("-DUSE_DYNAMIC_LOGGING_LEVELS=OFF")
@ -40,10 +47,8 @@ option (CHANGE_G3LOG_DEBUG_TO_DBUG
"Use DBUG logging level instead of DEBUG. By default DEBUG is the debugging level" OFF) "Use DBUG logging level instead of DEBUG. By default DEBUG is the debugging level" OFF)
IF(CHANGE_G3LOG_DEBUG_TO_DBUG) IF(CHANGE_G3LOG_DEBUG_TO_DBUG)
LIST(APPEND G3_DEFINITIONS CHANGE_G3LOG_DEBUG_TO_DBUG) LIST(APPEND G3_DEFINITIONS CHANGE_G3LOG_DEBUG_TO_DBUG)
add_definitions(-DCHANGE_G3LOG_DEBUG_TO_DBUG) MESSAGE("-DCHANGE_G3LOG_DEBUG_TO_DBUG=ON DBUG instead of DEBUG logging level is used")
MESSAGE("-DCHANGE_G3LOG_DEBUG_TO_DBUG=ON DBUG instead of DEBUG logging level can be used. Make sure to have:") ELSE()
MESSAGE(" [#define CHANGE_G3LOG_DEBUG_TO_DBUG 1] in your source code")
ELSE()
MESSAGE("-DCHANGE_G3LOG_DEBUG_TO_DBUG=OFF \t(Debuggin logging level is 'DEBUG')") MESSAGE("-DCHANGE_G3LOG_DEBUG_TO_DBUG=OFF \t(Debuggin logging level is 'DEBUG')")
ENDIF(CHANGE_G3LOG_DEBUG_TO_DBUG) ENDIF(CHANGE_G3LOG_DEBUG_TO_DBUG)
@ -57,9 +62,8 @@ option (ENABLE_FATAL_SIGNALHANDLING
IF(NOT ENABLE_FATAL_SIGNALHANDLING) IF(NOT ENABLE_FATAL_SIGNALHANDLING)
LIST(APPEND G3_DEFINITIONS DISABLE_FATAL_SIGNALHANDLING) LIST(APPEND G3_DEFINITIONS DISABLE_FATAL_SIGNALHANDLING)
add_definitions(-DDISABLE_FATAL_SIGNALHANDLING)
MESSAGE("-DENABLE_FATAL_SIGNALHANDLING=OFF Fatal signal handler is disabled. Make sure to have:") MESSAGE("-DENABLE_FATAL_SIGNALHANDLING=OFF Fatal signal handler is disabled")
MESSAGE(" [#define DISABLE_FATAL_SIGNALHANDLING 1] in your source code")
ELSE() ELSE()
MESSAGE("-DENABLE_FATAL_SIGNALHANDLING=ON\tFatal signal handler is enabled") MESSAGE("-DENABLE_FATAL_SIGNALHANDLING=ON\tFatal signal handler is enabled")
ENDIF(NOT ENABLE_FATAL_SIGNALHANDLING) ENDIF(NOT ENABLE_FATAL_SIGNALHANDLING)
@ -75,10 +79,7 @@ IF (MSVC OR MINGW)
IF(NOT ENABLE_VECTORED_EXCEPTIONHANDLING) IF(NOT ENABLE_VECTORED_EXCEPTIONHANDLING)
LIST(APPEND G3_DEFINITIONS DISABLE_VECTORED_EXCEPTIONHANDLING) LIST(APPEND G3_DEFINITIONS DISABLE_VECTORED_EXCEPTIONHANDLING)
add_definitions(-DDISABLE_VECTORED_EXCEPTIONHANDLING) MESSAGE("-DENABLE_VECTORED_EXCEPTIONHANDLING=OFF Vectored exception handling is disabled")
MESSAGE("-DENABLE_VECTORED_EXCEPTIONHANDLING=OFF Vectored exception handling is disabled. Make sure to have:")
MESSaGE(" [#define DISABLE_VECTORED_EXCEPTIONHANDLING 1] in your source code")
ELSE() ELSE()
MESSAGE("-DENABLE_VECTORED_EXCEPTIONHANDLING=ON\t\t\tVectored exception handling is enabled") MESSAGE("-DENABLE_VECTORED_EXCEPTIONHANDLING=ON\t\t\tVectored exception handling is enabled")
ENDIF(NOT ENABLE_VECTORED_EXCEPTIONHANDLING) ENDIF(NOT ENABLE_VECTORED_EXCEPTIONHANDLING)
@ -90,18 +91,15 @@ IF (MSVC OR MINGW)
# receives a fatal signal. # receives a fatal signal.
# #
option (DEBUG_BREAK_AT_FATAL_SIGNAL option (DEBUG_BREAK_AT_FATAL_SIGNAL
"Enable Visual Studio break point when receiving a fatal exception. In __DEBUG mode only" ON) "Enable Visual Studio break point when receiving a fatal exception. In __DEBUG mode only" OFF)
IF(DEBUG_BREAK_AT_FATAL_SIGNAL) IF(DEBUG_BREAK_AT_FATAL_SIGNAL)
LIST(APPEND G3_DEFINITIONS DEBUG_BREAK_AT_FATAL_SIGNAL) LIST(APPEND G3_DEFINITIONS DEBUG_BREAK_AT_FATAL_SIGNAL)
add_definitions(-DDEBUG_BREAK_AT_FATAL_SIGNAL) MESSAGE("-DDEBUG_BREAK_AT_FATAL_SIGNAL=ON Break point for fatal signal is enabled for __DEBUG.")
MESSAGE("-DDEBUG_BREAK_AT_FATAL_SIGNAL=ON Break point for fatal signal is enabled for __DEBUG.Make sure to have:")
MESSAGE(" [#define DEBUG_BREAK_AT_FATAL_SIGNAL 1] in your source code")
ELSE() ELSE()
MESSAGE("-DDEBUG_BREAK_AT_FATAL_SIGNAL=OFF\t\t\tBreak point for fatal signal is disabled") MESSAGE("-DDEBUG_BREAK_AT_FATAL_SIGNAL=OFF\t\t\tBreak point for fatal signal is disabled")
ENDIF(DEBUG_BREAK_AT_FATAL_SIGNAL) ENDIF(DEBUG_BREAK_AT_FATAL_SIGNAL)
ENDIF (MSVC OR MINGW) ENDIF (MSVC OR MINGW)
MESSAGE("\n\n\n") MESSAGE("\n\n\n")

View File

@ -10,7 +10,8 @@
#include <string> #include <string>
#include <csignal> #include <csignal>
#include "g3log/loglevels.hpp" #include "g3log/loglevels.hpp"
#include "g3log/generated_definitions.hpp"
// kjell. Separera på crashhandler.hpp och crashhanlder_internal.hpp // kjell. Separera på crashhandler.hpp och crashhanlder_internal.hpp
// implementationsfilen kan vara den samma // implementationsfilen kan vara den samma
namespace g3 { namespace g3 {

View File

@ -7,6 +7,7 @@
* ============================================================================*/ * ============================================================================*/
#pragma once #pragma once
#include "g3log/generated_definitions.hpp"
// Users of Juce or other libraries might have a define DEBUG which clashes with // Users of Juce or other libraries might have a define DEBUG which clashes with
// the DEBUG logging level for G3log. In that case they can instead use the define // the DEBUG logging level for G3log. In that case they can instead use the define

View File

@ -41,11 +41,6 @@ namespace g3 {
} }
#ifdef G3_DYNAMIC_LOGGING #ifdef G3_DYNAMIC_LOGGING
// All levels are by default ON: i.e. for DEBUG, INFO, WARNING, FATAL
const int g_level_size {
FATAL.value + 1
};
//std::atomic<bool> g_log_level_status[4] {{true}, {true}, {true}, {true}};
std::map<int, atomicbool> g_log_level_status = {{g3::kDebugVaulue, true}, {INFO.value, true}, {WARNING.value, true}, {FATAL.value, true}}; std::map<int, atomicbool> g_log_level_status = {{g3::kDebugVaulue, true}, {INFO.value, true}, {WARNING.value, true}, {FATAL.value, true}};
#endif #endif
} // internal } // internal