mirror of
https://github.com/KjellKod/g3log.git
synced 2024-12-12 10:23:50 +01:00
__SIGFUNC__ no longer default for Windows. __PRETTY__FUNCTION no longer default for gcc/clang (#470)
* __SIGFUNC__ no longer default for Windows, It has to be explicitly picked through CMAKE option * __PRETTY_FUNCTION__ no longer default for gcc/clang, It has to be explicitly picked through CMAKE option
This commit is contained in:
parent
881e6da439
commit
dbd3d74a39
@ -14,6 +14,8 @@
|
|||||||
# to the auto generated file src/g3log/generated_definitions.hpp
|
# to the auto generated file src/g3log/generated_definitions.hpp
|
||||||
# add_definitions(-DG3_DYNAMIC_LOGGING)
|
# add_definitions(-DG3_DYNAMIC_LOGGING)
|
||||||
# add_definitions(-DCHANGE_G3LOG_DEBUG_TO_DBUG)
|
# add_definitions(-DCHANGE_G3LOG_DEBUG_TO_DBUG)
|
||||||
|
# add_definitions(-DWINDOWS_FUNCSIG)
|
||||||
|
# add_definitions(-DPRETTY_FUNCTION)
|
||||||
# add_definitions(-DDISABLE_FATAL_SIGNALHANDLING)
|
# add_definitions(-DDISABLE_FATAL_SIGNALHANDLING)
|
||||||
# add_definitions(-DDISABLE_VECTORED_EXCEPTIONHANDLING)
|
# add_definitions(-DDISABLE_VECTORED_EXCEPTIONHANDLING)
|
||||||
# add_definitions(-DDEBUG_BREAK_AT_FATAL_SIGNAL)
|
# add_definitions(-DDEBUG_BREAK_AT_FATAL_SIGNAL)
|
||||||
@ -61,6 +63,31 @@ ELSE()
|
|||||||
ENDIF(CHANGE_G3LOG_DEBUG_TO_DBUG)
|
ENDIF(CHANGE_G3LOG_DEBUG_TO_DBUG)
|
||||||
|
|
||||||
|
|
||||||
|
# -DWINDOWS_USE_FUNCSIG=ON : (Default OFF) Override the use of __FUNCTION__ for Windows platform and instead use __FUNCSIG__
|
||||||
|
option (WINDOWS_FUNCSIG
|
||||||
|
"Windows __FUNCSIG__ to expand `Function` location of the LOG call instead of the default __FUNCTION__" OFF)
|
||||||
|
IF(WINDOWS_FUNCSIG)
|
||||||
|
LIST(APPEND G3_DEFINITIONS WINDOWS_FUNCSIG)
|
||||||
|
message( STATUS "-DWINDOWS_FUNCSIG=ON\t\t__SIGFUNC__ is used instead of the default __FUNCTION__ for LOG call locations" )
|
||||||
|
ELSE()
|
||||||
|
message( STATUS "-DWINDOWS_FUNCSIG=OFF")
|
||||||
|
ENDIF(WINDOWS_FUNCSIG)
|
||||||
|
|
||||||
|
|
||||||
|
# -DPRETTY_FUNCTION=ON : (Default OFF) Override the use of __FUNCTION__ for Windows platform and instead use __FUNCSIG__
|
||||||
|
# NOTE: heavy templated integrations such as boost log calls that shows the function name can cause function name expansion
|
||||||
|
# to "spam" the LOG output with the now visible template arguments.
|
||||||
|
option (PRETTY_FUNCTION
|
||||||
|
"Windows __PRETTY_FUNCTION__ to expand `Function` location of the LOG call instead of the default __FUNCTION__" OFF)
|
||||||
|
IF(PRETTY_FUNCTION)
|
||||||
|
LIST(APPEND G3_DEFINITIONS PRETTY_FUNCTION)
|
||||||
|
message( STATUS "-DPRETTY_FUNCTION=ON\t\t__PRETTY_FUNCTION__ is used instead of the default __FUNCTION__ for LOG call locations" )
|
||||||
|
ELSE()
|
||||||
|
message( STATUS "-DPRETTY_FUNCTION=OFF")
|
||||||
|
ENDIF(PRETTY_FUNCTION)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -DG3_DYNAMIC_MAX_MESSAGE_SIZE : use dynamic memory for final_message in logcapture.cpp
|
# -DG3_DYNAMIC_MAX_MESSAGE_SIZE : use dynamic memory for final_message in logcapture.cpp
|
||||||
option (USE_G3_DYNAMIC_MAX_MESSAGE_SIZE
|
option (USE_G3_DYNAMIC_MAX_MESSAGE_SIZE
|
||||||
"Use dynamic memory for message buffer during log capturing" OFF)
|
"Use dynamic memory for message buffer during log capturing" OFF)
|
||||||
|
@ -24,7 +24,7 @@ before_build:
|
|||||||
- cd build
|
- cd build
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- cmake -G "Visual Studio 15 2017 Win64" -DADD_G3LOG_UNIT_TEST=ON -DUSE_DYNAMIC_LOGGING_LEVELS=ON -DCHANGE_G3LOG_DEBUG_TO_DBUG=ON -DCMAKE_INSTALL_PREFIX=c:\g3log ..
|
- cmake -G "Visual Studio 15 2017 Win64" -DADD_G3LOG_UNIT_TEST=ON -DWINDOWS_FUNCSIG=ON -DUSE_DYNAMIC_LOGGING_LEVELS=ON -DCHANGE_G3LOG_DEBUG_TO_DBUG=ON -DCMAKE_INSTALL_PREFIX=c:\g3log ..
|
||||||
- cmake --build . --config Release --target install
|
- cmake --build . --config Release --target install
|
||||||
|
|
||||||
# scripts to run after build
|
# scripts to run after build
|
||||||
|
@ -47,6 +47,21 @@ ADD_G3LOG_UNIT_TEST:BOOL=OFF
|
|||||||
// By default DEBUG is the debugging level
|
// By default DEBUG is the debugging level
|
||||||
CHANGE_G3LOG_DEBUG_TO_DBUG:BOOL=OFF
|
CHANGE_G3LOG_DEBUG_TO_DBUG:BOOL=OFF
|
||||||
|
|
||||||
|
|
||||||
|
// Windows only: Use __FUNCSIG__ instead of the default __FUNCTION__
|
||||||
|
// to show LOG function location
|
||||||
|
// WARNING: using this in heavily templated code, like boost can expand
|
||||||
|
// the function name into massive size
|
||||||
|
WINDOWS_FUNCSIG:BOOL=OFF
|
||||||
|
|
||||||
|
|
||||||
|
// gcc/clang only: Use __PRETTY_FUNCTION__ instead of the default __FUNCTION__
|
||||||
|
// to show LOG function location
|
||||||
|
// WARNING: using this in heavily templated code, like boost can expand
|
||||||
|
// the function name into massive size
|
||||||
|
PRETTY_FUNCTION:BOOL=OFF
|
||||||
|
|
||||||
|
|
||||||
// Specifies the build type on single-configuration generators.
|
// Specifies the build type on single-configuration generators.
|
||||||
// Possible values are empty, Debug, Release, RelWithDebInfo, MinSizeRel, …
|
// Possible values are empty, Debug, Release, RelWithDebInfo, MinSizeRel, …
|
||||||
CMAKE_BUILD_TYPE:STRING=
|
CMAKE_BUILD_TYPE:STRING=
|
||||||
|
@ -6,7 +6,7 @@ set -x
|
|||||||
|
|
||||||
mkdir -p build_travis
|
mkdir -p build_travis
|
||||||
cd build_travis
|
cd build_travis
|
||||||
cmake -DADD_G3LOG_BENCH_PERFORMANCE=ON -DADD_G3LOG_UNIT_TEST=ON -DCMAKE_INSTALL_PREFIX=./install -DCPACK_PACKAGING_INSTALL_PREFIX=/opt/g3log ..
|
cmake -DADD_G3LOG_BENCH_PERFORMANCE=ON -DPRETTY_FUNCTION=ON -DADD_G3LOG_UNIT_TEST=ON -DCMAKE_INSTALL_PREFIX=./install -DCPACK_PACKAGING_INSTALL_PREFIX=/opt/g3log ..
|
||||||
cmake --build . --target install
|
cmake --build . --target install
|
||||||
|
|
||||||
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||||
|
@ -29,12 +29,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (defined(WINDOWS_FUNCSIG)) // Microsoft
|
||||||
#if defined(__GNUC__) // GCC extension compatible
|
|
||||||
#define G3LOG_PRETTY_FUNCTION __PRETTY_FUNCTION__
|
|
||||||
#elif defined(_MSC_VER) // Microsoft
|
|
||||||
#define G3LOG_PRETTY_FUNCTION __FUNCSIG__
|
#define G3LOG_PRETTY_FUNCTION __FUNCSIG__
|
||||||
#else // __func__ is fallback to c99 / c++11, where that doesn't matter so __FUNCTION__ is the choice
|
#elif defined(__GNUC__) && defined(PRETTY_FUNCTION) // GCC compatible
|
||||||
|
#define G3LOG_PRETTY_FUNCTION __PRETTY_FUNCTION__
|
||||||
|
#else
|
||||||
#define G3LOG_PRETTY_FUNCTION __FUNCTION__
|
#define G3LOG_PRETTY_FUNCTION __FUNCTION__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user