From ad07220baf9ccbf594c4413f99b2f0958bb8c766 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 28 Dec 2018 19:49:49 +0100 Subject: [PATCH] Move logging defines to QMAKE instead of logging.h Defines done outside of easylogging++.h does not work according to official documentation (https://github.com/zuhd-org/easyloggingpp/blob/master/README.md#configuration-macros) "NOTE: All the macros can be defined in one of the following ways: 1. Define macros using -D option of compiler, for example in case of g++ you will do g++ source.cpp ... -DELPP_SYSLOG -DELPP_THREAD_SAFE ... (recommended way) 2. Define macros inside "easylogging++.h" (defining macros in other files won't work)" Linking to this issue: https://github.com/zuhd-org/easyloggingpp/issues/590#issuecomment-346753951 We are using the developer recommended way of defining them by command line. What is assumed to be the intention of enabling debug logs before including easylogging++ never actually did anything, hence this define is dropped. Newer versions of easylogging++ uses the macro ELPP_DISABLE_DEBUG_LOGS to _disable_ debug logs. Leaving that macro undefined satisfies the original intent. --- advancedSettings.pro | 2 ++ src/logging.h | 14 +------------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/advancedSettings.pro b/advancedSettings.pro index 9458a0f..9f1970a 100644 --- a/advancedSettings.pro +++ b/advancedSettings.pro @@ -7,6 +7,8 @@ QT += core gui qml quick multimedia widgets CONFIG += c++11 +DEFINES += ELPP_THREAD_SAFE ELPP_QT_LOGGING ELPP_NO_DEFAULT_LOG_FILE + lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.6 or higher") lessThan(QT_MINOR_VERSION, 6): error("requires Qt 5.6 or higher") diff --git a/src/logging.h b/src/logging.h index 5a8dd38..486f02d 100644 --- a/src/logging.h +++ b/src/logging.h @@ -1,16 +1,4 @@ #pragma once // easylogging includes -#ifndef _DEBUG -# define _DEBUG -# define ELPP_THREAD_SAFE -# define ELPP_QT_LOGGING -# define ELPP_NO_DEFAULT_LOG_FILE -# include -# undef _DEBUG -#else -# define ELPP_THREAD_SAFE -# define ELPP_QT_LOGGING -# define ELPP_NO_DEFAULT_LOG_FILE -# include -#endif +#include