From 67aaef771fd028be0af38348976ae26483996c51 Mon Sep 17 00:00:00 2001 From: Stefan Pranger Date: Tue, 29 Jun 2021 11:34:30 +0200 Subject: [PATCH] debug statements only show filename --- CMakeLists.txt | 2 ++ io/debug.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3da3d2d..a4dd143 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ include_directories(${PROJECT_SOURCE_DIR} ) add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/thirdparty/SQLiteCpp) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(notdir $(abspath $@))\"'") + add_executable(notification-daemon calendar-daemon.cpp diff --git a/io/debug.h b/io/debug.h index 9e28fc6..9641c2f 100644 --- a/io/debug.h +++ b/io/debug.h @@ -13,8 +13,9 @@ struct X { #endif }; -#define DEBUG (X(), std::cout << "DEBUG[" << __FILE__ << ":" << __LINE__ << " in " << __func__ << "()]: ") -#define WARN (X(), std::cout << "WARN [" << __FILE__ << ":" << __LINE__ << " in " << __func__ << "()]: ") + +#define DEBUG (X(), std::cout << "DEBUG[" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ") +#define WARN (X(), std::cout << "WARN [" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ") #ifdef LOG_DEBUG #define STEP \