feat: reduce logs
This commit is contained in:
parent
8a0cbb77bb
commit
1784fefaa1
@ -58,7 +58,7 @@ void GpgFrontend::GpgCommandExecutor::Execute(
|
||||
|
||||
Thread::Task::TaskRunnable runner =
|
||||
[](GpgFrontend::Thread::Task::DataObjectPtr data_object) -> int {
|
||||
SPDLOG_INFO("process runner called, data object size: {}",
|
||||
SPDLOG_DEBUG("process runner called, data object size: {}",
|
||||
data_object->GetObjectSize());
|
||||
|
||||
if (data_object->GetObjectSize() != 4)
|
||||
@ -66,7 +66,7 @@ void GpgFrontend::GpgCommandExecutor::Execute(
|
||||
|
||||
// get arguments
|
||||
auto cmd = data_object->PopObject<std::string>();
|
||||
SPDLOG_INFO("get cmd: {}", cmd);
|
||||
SPDLOG_DEBUG("get cmd: {}", cmd);
|
||||
auto arguments = data_object->PopObject<std::vector<std::string>>();
|
||||
auto interact_func =
|
||||
data_object->PopObject<std::function<void(QProcess *)>>();
|
||||
@ -79,22 +79,31 @@ void GpgFrontend::GpgCommandExecutor::Execute(
|
||||
QObject::connect(
|
||||
cmd_process, &QProcess::readyReadStandardOutput,
|
||||
[interact_func, cmd_process]() { interact_func(cmd_process); });
|
||||
QObject::connect(
|
||||
cmd_process, &QProcess::errorOccurred,
|
||||
QObject::connect(cmd_process, &QProcess::errorOccurred,
|
||||
[=](QProcess::ProcessError error) {
|
||||
SPDLOG_ERROR("error in executing command: {} error: {} stdout: {}",
|
||||
SPDLOG_ERROR(
|
||||
"error in executing command: {} error: {} stdout: "
|
||||
"{}, stderr: {} ",
|
||||
cmd, error,
|
||||
cmd_process->readAllStandardOutput().toStdString());
|
||||
cmd_process->readAllStandardOutput().toStdString(),
|
||||
cmd_process->readAllStandardError().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: {}",
|
||||
SPDLOG_DEBUG(
|
||||
"proceess finished, succeed in executing command: {}, exit "
|
||||
"status: {}",
|
||||
cmd, status);
|
||||
else
|
||||
SPDLOG_ERROR("error in executing command: {}, exit status: {}", cmd,
|
||||
status);
|
||||
SPDLOG_ERROR(
|
||||
"proceess finished, error in executing command: {}, exit "
|
||||
"status: {}, arguments: {}, stdout: {}, "
|
||||
"stderr: {}",
|
||||
cmd, status, cmd_process->arguments().join(" ").toStdString(),
|
||||
cmd_process->readAllStandardOutput().toStdString(),
|
||||
cmd_process->readAllStandardError().toStdString());
|
||||
});
|
||||
|
||||
cmd_process->setProgram(QString::fromStdString(cmd));
|
||||
|
@ -84,11 +84,11 @@ void GpgFrontend::Thread::TaskRunner::PostScheduleTask(Task* task,
|
||||
|
||||
if (task != nullptr) {
|
||||
// Run the task
|
||||
SPDLOG_TRACE("task runner: running task: {}", task->GetUUID());
|
||||
SPDLOG_TRACE("task runner: running task {}", task->GetUUID());
|
||||
try {
|
||||
task->run();
|
||||
} catch (const std::exception& e) {
|
||||
SPDLOG_ERROR("task runner: exception in task: {} , exception: {}",
|
||||
SPDLOG_ERROR("task runner: exception in task {}, exception: {}",
|
||||
task->GetUUID(), e.what());
|
||||
|
||||
// destroy the task, remove the task from the pending tasks
|
||||
|
@ -164,9 +164,6 @@ void init_logging_system() {
|
||||
ui_logger->flush_on(spdlog::level::err);
|
||||
spdlog::flush_every(std::chrono::seconds(5));
|
||||
|
||||
// register it
|
||||
spdlog::register_logger(ui_logger);
|
||||
|
||||
// register it as default logger
|
||||
spdlog::set_default_logger(ui_logger);
|
||||
}
|
||||
@ -193,7 +190,7 @@ void init_locale() {
|
||||
// sync the settings to the file
|
||||
GpgFrontend::GlobalSettingStation::GetInstance().SyncSettings();
|
||||
|
||||
SPDLOG_INFO("current system locale: {}", setlocale(LC_ALL, nullptr));
|
||||
SPDLOG_DEBUG("current system locale: {}", setlocale(LC_ALL, nullptr));
|
||||
|
||||
// read from settings file
|
||||
std::string lang;
|
||||
@ -201,9 +198,9 @@ void init_locale() {
|
||||
SPDLOG_ERROR(_("could not read properly from configure file"));
|
||||
};
|
||||
|
||||
SPDLOG_INFO("lang from settings: {}", lang);
|
||||
SPDLOG_INFO("project name: {}", PROJECT_NAME);
|
||||
SPDLOG_INFO(
|
||||
SPDLOG_DEBUG("lang from settings: {}", lang);
|
||||
SPDLOG_DEBUG("project name: {}", PROJECT_NAME);
|
||||
SPDLOG_DEBUG(
|
||||
"locales path: {}",
|
||||
GpgFrontend::GlobalSettingStation::GetInstance().GetLocaleDir().c_str());
|
||||
|
||||
@ -218,7 +215,7 @@ void init_locale() {
|
||||
// set LANGUAGE
|
||||
std::string language_env = language == nullptr ? "en" : language;
|
||||
language_env.insert(0, lang + ":");
|
||||
SPDLOG_INFO("language env: {}", language_env);
|
||||
SPDLOG_DEBUG("language env: {}", language_env);
|
||||
if (setenv("LANGUAGE", language_env.c_str(), 1)) {
|
||||
SPDLOG_WARN("set LANGUAGE failed", language_env);
|
||||
};
|
||||
@ -236,7 +233,7 @@ void init_locale() {
|
||||
std::string language_env = language == nullptr ? "en" : language;
|
||||
language_env.insert(0, lang + ":");
|
||||
language_env.insert(0, "LANGUAGE=");
|
||||
SPDLOG_INFO("language env: {}", language_env);
|
||||
SPDLOG_DEBUG("language env: {}", language_env);
|
||||
if (putenv(language_env.c_str())) {
|
||||
spdlog::warn, "set LANGUAGE failed", language_env;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user