mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-30 19:54:43 +00:00
added new option for desable logs
This commit is contained in:
parent
334e209ff4
commit
3b797f9a78
@ -41,11 +41,16 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
|
||||
option(QA_ASSERT_ON_WARN "Enable for add assert to every warning message" OFF)
|
||||
option(QA_ASSERT_ON_ERROR "Enable for add assert to every error message" OFF)
|
||||
option(QA_ALLOW_NOT_SUPPORTED_OPTIONS "Enable for allow any command line options" ON)
|
||||
option(QA_DISABLE_LOG "Disabled all logs (force sets verbose to 0)" OFF)
|
||||
|
||||
if (QA_ASSERT_ON_WARN)
|
||||
add_definitions(-DQA_ASSERT_ON_WARN)
|
||||
endif()
|
||||
|
||||
if (QA_DISABLE_LOG)
|
||||
add_definitions(-DQA_DISABLE_LOG)
|
||||
endif()
|
||||
|
||||
if (QA_ASSERT_ON_ERROR)
|
||||
add_definitions(-DQA_ASSERT_ON_ERROR)
|
||||
endif()
|
||||
|
@ -222,6 +222,8 @@ QString Params::lvlToString(VerboseLvl vLvl) {
|
||||
bool Params::writeLoginFile(const QString &log, VerboseLvl vLvl) {
|
||||
if (isEndable("fileLog")) {
|
||||
|
||||
auto lvl = getVerboseLvl();
|
||||
if (vLvl <= lvl) {
|
||||
QString path = getCurrentExecutable() + ".log";
|
||||
auto file = getArg("fileLog");
|
||||
if (file.size()) {
|
||||
@ -242,7 +244,7 @@ bool Params::writeLoginFile(const QString &log, VerboseLvl vLvl) {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
5
params.h
5
params.h
@ -31,12 +31,15 @@ enum VerboseLvl {
|
||||
Debug = 0x3,
|
||||
|
||||
};
|
||||
|
||||
#ifdef QA_DISABLE_LOG
|
||||
#define DEFAULT_VERBOSE_LVL "0"
|
||||
#else
|
||||
#ifdef QT_DEBUG
|
||||
#define DEFAULT_VERBOSE_LVL "3"
|
||||
#else
|
||||
#define DEFAULT_VERBOSE_LVL "2"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The Params class Contains fonctions for working with input arguments and logs.
|
||||
|
Loading…
x
Reference in New Issue
Block a user