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.
This commit is contained in:
Vasily
2018-12-28 19:49:49 +01:00
parent 9519d96e93
commit ad07220baf
2 changed files with 3 additions and 13 deletions
+2
View File
@@ -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")
+1 -13
View File
@@ -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 <easylogging++.h>
# undef _DEBUG
#else
# define ELPP_THREAD_SAFE
# define ELPP_QT_LOGGING
# define ELPP_NO_DEFAULT_LOG_FILE
# include <easylogging++.h>
#endif
#include <easylogging++.h>