diff options
author | saturneric <[email protected]> | 2023-02-04 05:24:01 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-02-04 05:24:01 +0000 |
commit | 04c6005931a1226e795ec32b1b31a9c23dc24fda (patch) | |
tree | f421907f46606cff116a127001165060c89e3b20 | |
parent | feat: add submodule spdlog (diff) | |
download | GpgFrontend-04c6005931a1226e795ec32b1b31a9c23dc24fda.tar.gz GpgFrontend-04c6005931a1226e795ec32b1b31a9c23dc24fda.zip |
fix: solve some issues
1. solve compile issues
2. improve log for cammand executor
-rw-r--r-- | src/before_exit.cpp | 5 | ||||
-rw-r--r-- | src/core/GpgCoreInit.cpp | 2 | ||||
-rw-r--r-- | src/core/function/gpg/GpgCommandExecutor.cpp | 28 | ||||
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/ui/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/ui/GpgFrontendUIInit.cpp | 2 |
6 files changed, 26 insertions, 16 deletions
diff --git a/src/before_exit.cpp b/src/before_exit.cpp index 70768e05..3b0989fa 100644 --- a/src/before_exit.cpp +++ b/src/before_exit.cpp @@ -32,4 +32,7 @@ * @brief Actions performed before exiting the application * */ -void before_exit() { SPDLOG_INFO("called"); } +void before_exit() { + SPDLOG_INFO("called"); + spdlog::shutdown(); +} diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index d757c10c..ee42579d 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -68,7 +68,7 @@ void InitLoggingSystem() { #ifdef DEBUG core_logger->set_level(spdlog::level::trace); -#elif +#else core_logger->set_level(spdlog::level::info); #endif diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 720388a0..8f652b96 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -79,17 +79,23 @@ void GpgFrontend::GpgCommandExecutor::Execute( QObject::connect( cmd_process, &QProcess::readyReadStandardOutput, [interact_func, cmd_process]() { interact_func(cmd_process); }); - QObject::connect(cmd_process, &QProcess::errorOccurred, [=]() { - SPDLOG_ERROR("error in executing command: {}", cmd); - }); - QObject::connect(cmd_process, - qOverload<int, QProcess::ExitStatus>(&QProcess::finished), - [=](int, QProcess::ExitStatus status) { - if (status == QProcess::NormalExit) - SPDLOG_INFO("succeed in executing command: {}", cmd); - else - SPDLOG_WARN("error in executing command: {}", cmd); - }); + QObject::connect( + cmd_process, &QProcess::errorOccurred, + [=](QProcess::ProcessError error) { + SPDLOG_ERROR("error in executing command: {} error: {} stdout: {}", + cmd, error, + cmd_process->readAllStandardOutput().toStdString()); + }); + QObject::connect( + cmd_process, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), + [=](int, QProcess::ExitStatus status) { + if (status == QProcess::NormalExit) + SPDLOG_INFO("succeed in executing command: {}, exit status: {}", + cmd, status); + else + SPDLOG_ERROR("error in executing command: {}, exit status: {}", cmd, + status); + }); cmd_process->setProgram(QString::fromStdString(cmd)); diff --git a/src/init.cpp b/src/init.cpp index 20f033e0..7e6a76cc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -54,7 +54,7 @@ void init_logging_system() { #ifdef DEBUG main_logger->set_level(spdlog::level::trace); -#elif +#else core_logger->set_level(spdlog::level::info); #endif diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 24158e27..e40163b6 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -58,7 +58,8 @@ target_precompile_headers(gpgfrontend_ui PUBLIC GpgFrontendUI.h) # add ui generator include path target_include_directories(gpgfrontend_ui PUBLIC - ${CMAKE_CURRENT_BINARY_DIR}/gpgfrontend_ui_autogen/include) + ${CMAKE_CURRENT_BINARY_DIR}/gpgfrontend_ui_autogen/include + ${CMAKE_SOURCE_DIR}/third_party/spdlog/include) # using std c++ 17 target_compile_features(gpgfrontend_ui PUBLIC cxx_std_17) diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 0ebcd500..8beecea9 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -156,7 +156,7 @@ void init_logging_system() { #ifdef DEBUG ui_logger->set_level(spdlog::level::trace); -#elif +#else core_logger->set_level(spdlog::level::info); #endif |