diff options
author | Saturneric <[email protected]> | 2023-02-11 14:10:09 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-02-11 14:10:09 +0000 |
commit | 6a75817c85b0d4a97cea82ad2331736cff9913cf (patch) | |
tree | 261b01c4dc55a28241694a5e292d9fc5c77b6319 | |
parent | feat: upgrade qt framework to 6.3 (diff) | |
download | GpgFrontend-6a75817c85b0d4a97cea82ad2331736cff9913cf.tar.gz GpgFrontend-6a75817c85b0d4a97cea82ad2331736cff9913cf.zip |
fix: reduce info level logs
62 files changed, 282 insertions, 339 deletions
diff --git a/src/core/GpgConstants.cpp b/src/core/GpgConstants.cpp index 4f781ece..35e485d4 100644 --- a/src/core/GpgConstants.cpp +++ b/src/core/GpgConstants.cpp @@ -199,6 +199,6 @@ GpgFrontend::GpgGenKeyResult GpgFrontend::_new_result( } void GpgFrontend::_result_ref_deletor::operator()(void* _result) { - SPDLOG_INFO("called {}", _result); + SPDLOG_TRACE("gpgme unref {}", _result); if (_result != nullptr) gpgme_result_unref(_result); } diff --git a/src/core/GpgContext.cpp b/src/core/GpgContext.cpp index de6ea33c..9f69522a 100644 --- a/src/core/GpgContext.cpp +++ b/src/core/GpgContext.cpp @@ -60,7 +60,7 @@ GpgContext::GpgContext(const GpgContextInitArgs &args) : args_(args) { if (_first) { /* Initialize the locale environment. */ - SPDLOG_INFO("locale: {}", setlocale(LC_CTYPE, nullptr)); + SPDLOG_DEBUG("locale: {}", setlocale(LC_CTYPE, nullptr)); info_.GpgMEVersion = gpgme_check_version(nullptr); gpgme_set_locale(nullptr, LC_CTYPE, setlocale(LC_CTYPE, nullptr)); #ifdef LC_MESSAGES @@ -92,7 +92,7 @@ GpgContext::GpgContext(const GpgContextInitArgs &args) : args_(args) { continue; } - SPDLOG_INFO( + SPDLOG_DEBUG( "gpg context engine info: {} {} {} {}", gpgme_get_protocol_name(engine_info->protocol), std::string(engine_info->file_name == nullptr ? "null" @@ -141,7 +141,7 @@ GpgContext::GpgContext(const GpgContextInitArgs &args) : args_(args) { auto err = gpgme_ctx_set_engine_info(_ctx_ref.get(), GPGME_PROTOCOL_OpenPGP, info_.AppPath.c_str(), info_.DatabasePath.c_str()); - SPDLOG_INFO("ctx set custom key db path: {}", info_.DatabasePath); + SPDLOG_DEBUG("ctx set custom key db path: {}", info_.DatabasePath); assert(check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR); } @@ -156,7 +156,6 @@ GpgContext::GpgContext(const GpgContextInitArgs &args) : args_(args) { SPDLOG_ERROR("env check failed"); return; } else { - SPDLOG_INFO("gnupg version {}", info_.GnupgVersion); // async, init context Thread::TaskRunnerGetter::GetInstance() .GetTaskRunner(Thread::TaskRunnerGetter::kTaskRunnerType_GPG) @@ -173,7 +172,7 @@ void GpgContext::post_init_ctx() { // Set Independent Database if (info_.GnupgVersion <= "2.0.0" && args_.independent_database) { info_.DatabasePath = args_.db_path; - SPDLOG_INFO("custom key db path {}", info_.DatabasePath); + SPDLOG_DEBUG("custom key db path {}", info_.DatabasePath); auto err = gpgme_ctx_set_engine_info(_ctx_ref.get(), GPGME_PROTOCOL_OpenPGP, info_.AppPath.c_str(), info_.DatabasePath.c_str()); @@ -257,7 +256,7 @@ gpgme_error_t GpgContext::custom_passphrase_cb(void *opaque, const char *uid_hint, const char *passphrase_info, int last_was_bad, int fd) { - SPDLOG_INFO("custom passphrase cb called, bad times: {}", last_was_bad); + SPDLOG_DEBUG("custom passphrase cb called, bad times: {}", last_was_bad); if (last_was_bad > 3) { SPDLOG_WARN("failure_counts is over three times"); @@ -293,7 +292,7 @@ gpgme_error_t GpgContext::custom_passphrase_cb(void *opaque, gpgme_error_t GpgContext::test_status_cb(void *hook, const char *keyword, const char *args) { - SPDLOG_INFO("keyword {}", keyword); + SPDLOG_DEBUG("keyword {}", keyword); return GPG_ERR_NO_ERROR; } @@ -325,7 +324,7 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { GpgCommandExecutor::GetInstance().Execute( info_.GpgConfPath, {"--list-components"}, [=](int exit_code, const std::string &p_out, const std::string &p_err) { - SPDLOG_INFO( + SPDLOG_DEBUG( "gpgconf components exit_code: {} process stdout size: {}", exit_code, p_out.size()); @@ -393,7 +392,7 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { GpgCommandExecutor::GetInstance().Execute( info_.GpgConfPath, {"--list-dirs"}, [=](int exit_code, const std::string &p_out, const std::string &p_err) { - SPDLOG_INFO( + SPDLOG_DEBUG( "gpgconf configurations exit_code: {} process stdout size: {}", exit_code, p_out.size()); @@ -413,8 +412,8 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { for (const auto &line : line_split_list) { std::vector<std::string> info_split_list; boost::split(info_split_list, line, boost::is_any_of(":")); - SPDLOG_INFO("gpgconf info line: {} info size: {}", line, - info_split_list.size()); + SPDLOG_DEBUG("gpgconf info line: {} info size: {}", line, + info_split_list.size()); if (info_split_list.size() != 2) continue; @@ -429,7 +428,7 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { }); for (const auto &component : info_.ComponentsInfo) { - SPDLOG_INFO("gpgconf check options ready", "component", component.first); + SPDLOG_DEBUG("gpgconf check options ready", "component", component.first); if (component.first == "gpgme" || component.first == "gpgconf") continue; @@ -437,7 +436,7 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { info_.GpgConfPath, {"--check-options", component.first}, [=](int exit_code, const std::string &p_out, const std::string &p_err) { - SPDLOG_INFO( + SPDLOG_DEBUG( "gpgconf options exit_code: {} process stdout size: {} " "component: {} ", exit_code, p_out.size(), component.first); @@ -459,8 +458,8 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { std::vector<std::string> info_split_list; boost::split(info_split_list, line, boost::is_any_of(":")); - SPDLOG_INFO("gpgconf info line: {} info size: {}", line, - info_split_list.size()); + SPDLOG_DEBUG("gpgconf info line: {} info size: {}", line, + info_split_list.size()); if (info_split_list.size() != 6) continue; @@ -473,7 +472,7 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { } for (const auto &component : info_.ComponentsInfo) { - SPDLOG_INFO("gpgconf list options ready", "component", component.first); + SPDLOG_DEBUG("gpgconf list options ready", "component", component.first); if (component.first == "gpgme" || component.first == "gpgconf") continue; @@ -481,7 +480,7 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { info_.GpgConfPath, {"--list-options", component.first}, [=](int exit_code, const std::string &p_out, const std::string &p_err) { - SPDLOG_INFO( + SPDLOG_DEBUG( "gpgconf options exit_code: {} process stdout size: {} " "component: {} ", exit_code, p_out.size(), component.first); @@ -503,8 +502,8 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { std::vector<std::string> info_split_list; boost::split(info_split_list, line, boost::is_any_of(":")); - SPDLOG_INFO("gpgconf info line: {} info size: {}", line, - info_split_list.size()); + SPDLOG_DEBUG("gpgconf info line: {} info size: {}", line, + info_split_list.size()); if (info_split_list.size() != 10) continue; diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index cdda3a67..977bb50c 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -96,8 +96,8 @@ void init_gpgfrontend_core() { SPDLOG_ERROR("setting operation error: use_custom_key_database_path"); } - SPDLOG_INFO("core loaded if use custom key databse path: {}", - use_custom_key_database_path); + SPDLOG_DEBUG("core loaded if use custom key databse path: {}", + use_custom_key_database_path); std::string custom_key_database_path; try { @@ -110,8 +110,8 @@ void init_gpgfrontend_core() { SPDLOG_ERROR("setting operation error: custom_key_database_path"); } - SPDLOG_INFO("core loaded custom key databse path: {}", - custom_key_database_path); + SPDLOG_DEBUG("core loaded custom key databse path: {}", + custom_key_database_path); // init default channel GpgFrontend::GpgContext::CreateInstance( diff --git a/src/core/GpgFunctionObject.cpp b/src/core/GpgFunctionObject.cpp index 3956e31e..0ddc290c 100644 --- a/src/core/GpgFunctionObject.cpp +++ b/src/core/GpgFunctionObject.cpp @@ -125,8 +125,8 @@ GpgFrontend::SingletonStorageCollection::GetInstance( if (force_refresh || instance == nullptr) { instance = new SingletonStorageCollection(); - SPDLOG_INFO("new single storage collection created: {}", - static_cast<void*>(instance)); + SPDLOG_DEBUG("new single storage collection created: {}", + static_cast<void*>(instance)); } return instance; diff --git a/src/core/GpgGenKeyInfo.cpp b/src/core/GpgGenKeyInfo.cpp index ba60c92a..290c93c2 100644 --- a/src/core/GpgGenKeyInfo.cpp +++ b/src/core/GpgGenKeyInfo.cpp @@ -38,7 +38,7 @@ void GpgFrontend::GenKeyInfo::SetAlgo( const GpgFrontend::GenKeyInfo::KeyGenAlgo &m_algo) { - SPDLOG_INFO("set algo name: {}", m_algo.first); + SPDLOG_DEBUG("set algo name: {}", m_algo.first); // Check algo if supported std::string algo_args = m_algo.second; if (standalone_) { diff --git a/src/core/common/CoreCommonUtil.cpp b/src/core/common/CoreCommonUtil.cpp index 54400e24..9d0d0bd5 100644 --- a/src/core/common/CoreCommonUtil.cpp +++ b/src/core/common/CoreCommonUtil.cpp @@ -33,7 +33,6 @@ namespace GpgFrontend { std::unique_ptr<CoreCommonUtil> CoreCommonUtil::instance_ = nullptr; ///<
CoreCommonUtil *CoreCommonUtil::GetInstance() {
- SPDLOG_INFO("called");
if (instance_ == nullptr) {
instance_ = std::make_unique<CoreCommonUtil>();
}
diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index d8a798fb..04c9326f 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -55,7 +55,7 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( const std::filesystem::path &base_path, const std::filesystem::path &archive_path, int compress, const std::vector<std::filesystem::path> &files) { - SPDLOG_INFO("CreateArchive: {}", archive_path.u8string()); + SPDLOG_DEBUG("CreateArchive: {}", archive_path.u8string()); auto current_base_path_backup = QDir::currentPath(); QDir::setCurrent(base_path.u8string().c_str()); @@ -74,7 +74,7 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( ssize_t len; int fd; - SPDLOG_INFO("compress: {}", compress); + SPDLOG_DEBUG("compress: {}", compress); a = archive_write_new(); switch (compress) { @@ -119,7 +119,7 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( #endif int r; - SPDLOG_INFO("reading file: {}", file.u8string()); + SPDLOG_DEBUG("reading file: {}", file.u8string()); #ifdef WINDOWS r = archive_read_disk_open_w(disk, file.wstring().c_str()); @@ -127,7 +127,7 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( r = archive_read_disk_open(disk, file.u8string().c_str()); #endif - SPDLOG_INFO("read file done: {}", file.u8string()); + SPDLOG_DEBUG("read file done: {}", file.u8string()); if (r != ARCHIVE_OK) { SPDLOG_ERROR("{archive_read_disk_open() failed: {}", @@ -158,9 +158,9 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( auto entry_path = std::string(archive_entry_pathname_utf8(entry)); #endif - SPDLOG_INFO("Adding: {} size: {} bytes: {} file type: {}", - archive_entry_pathname_utf8(entry), archive_entry_size(entry), - archive_entry_filetype(entry)); + SPDLOG_DEBUG("Adding: {} size: {} bytes: {} file type: {}", + archive_entry_pathname_utf8(entry), + archive_entry_size(entry), archive_entry_filetype(entry)); r = archive_write_header(a, entry); if (r < ARCHIVE_OK) { @@ -193,7 +193,7 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( void GpgFrontend::ArchiveFileOperator::ExtractArchive( const std::filesystem::path &archive_path, const std::filesystem::path &base_path) { - SPDLOG_INFO("ExtractArchive: {}", archive_path.u8string()); + SPDLOG_DEBUG("ExtractArchive: {}", archive_path.u8string()); auto current_base_path_backup = QDir::currentPath(); QDir::setCurrent(base_path.u8string().c_str()); @@ -249,9 +249,9 @@ void GpgFrontend::ArchiveFileOperator::ExtractArchive( archive_error_string(a)); throw std::runtime_error("archive_read_next_header() failed"); } - SPDLOG_INFO("Adding: {} size: {} bytes: {} file type: {}", - archive_entry_pathname_utf8(entry), archive_entry_size(entry), - archive_entry_filetype(entry)); + SPDLOG_DEBUG("Adding: {} size: {} bytes: {} file type: {}", + archive_entry_pathname_utf8(entry), archive_entry_size(entry), + archive_entry_filetype(entry)); r = archive_write_header(ext, entry); if (r != ARCHIVE_OK) { SPDLOG_ERROR("archive_write_header() failed: {}", @@ -285,8 +285,8 @@ void GpgFrontend::ArchiveFileOperator::ListArchive( 10240); // Note 1 if (r != ARCHIVE_OK) return; while (archive_read_next_header(a, &entry) == ARCHIVE_OK) { - SPDLOG_INFO("File: {}", archive_entry_pathname(entry)); - SPDLOG_INFO("File Path: {}", archive_entry_pathname(entry)); + SPDLOG_DEBUG("File: {}", archive_entry_pathname(entry)); + SPDLOG_DEBUG("File Path: {}", archive_entry_pathname(entry)); archive_read_data_skip(a); // Note 2 } r = archive_read_free(a); // Note 3 diff --git a/src/core/function/CharsetOperator.cpp b/src/core/function/CharsetOperator.cpp index 5b14261f..0e40e317 100644 --- a/src/core/function/CharsetOperator.cpp +++ b/src/core/function/CharsetOperator.cpp @@ -50,7 +50,7 @@ GpgFrontend::CharsetOperator::CharsetInfo GpgFrontend::CharsetOperator::Detect( return {"unknown", "unknown", 0}; } - SPDLOG_INFO("detecting charset buffer: {} bytes", buffer.size()); + SPDLOG_DEBUG("detecting charset buffer: {} bytes", buffer.size()); status = U_ZERO_ERROR; ucsdet_setText(csd, buffer.data(), buffer.size(), &status); @@ -77,7 +77,7 @@ GpgFrontend::CharsetOperator::CharsetInfo GpgFrontend::CharsetOperator::Detect( const char *language = ucsdet_getLanguage(ucm, &status); if (U_FAILURE(status)) return {name, "unknown", confidence}; - SPDLOG_INFO("Detected charset: {} {} {}", name, language, confidence); + SPDLOG_DEBUG("Detected charset: {} {} {}", name, language, confidence); return {name, language, confidence}; } @@ -88,7 +88,7 @@ bool GpgFrontend::CharsetOperator::Convert2Utf8(const std::string &buffer, const auto from_encode = std::string("utf-8"); const auto to_encode = from_charset_name; - SPDLOG_INFO("Converting buffer: {}", buffer.size()); + SPDLOG_DEBUG("Converting buffer: {}", buffer.size()); // test if the charset is supported UConverter *conv = ucnv_open(from_encode.c_str(), &status); @@ -130,6 +130,6 @@ bool GpgFrontend::CharsetOperator::Convert2Utf8(const std::string &buffer, return false; } - SPDLOG_INFO("converted buffer: {} bytes", out_buffer.size()); + SPDLOG_DEBUG("converted buffer: {} bytes", out_buffer.size()); return true; }
\ No newline at end of file diff --git a/src/core/function/DataObjectOperator.cpp b/src/core/function/DataObjectOperator.cpp index a476bdfe..180cef30 100644 --- a/src/core/function/DataObjectOperator.cpp +++ b/src/core/function/DataObjectOperator.cpp @@ -36,7 +36,7 @@ #include "core/function/PassphraseGenerator.h" void GpgFrontend::DataObjectOperator::init_app_secure_key() { - SPDLOG_INFO("initializing application secure key"); + SPDLOG_DEBUG("initializing application secure key"); FileOperator::WriteFileStd(app_secure_key_path_, PassphraseGenerator::GetInstance().Generate(256)); std::filesystem::permissions( @@ -60,7 +60,7 @@ GpgFrontend::DataObjectOperator::DataObjectOperator(int channel) } hash_key_ = QCryptographicHash::hash(QByteArray::fromStdString(key), QCryptographicHash::Sha256); - SPDLOG_INFO("app secure key loaded {} bytes", hash_key_.size()); + SPDLOG_DEBUG("app secure key loaded {} bytes", hash_key_.size()); if (!exists(app_data_objs_path_)) create_directory(app_data_objs_path_); } @@ -93,8 +93,8 @@ std::string GpgFrontend::DataObjectOperator::SaveDataObj( auto encoded = encryption.encode(QByteArray::fromStdString(to_string(value)), hash_key_); - SPDLOG_INFO("saving data object {} to {} , size: {} bytes", _hash_obj_key, - obj_path.u8string(), encoded.size()); + SPDLOG_DEBUG("saving data object {} to {} , size: {} bytes", _hash_obj_key, + obj_path.u8string(), encoded.size()); FileOperator::WriteFileStd(obj_path.u8string(), encoded.toStdString()); @@ -104,7 +104,7 @@ std::string GpgFrontend::DataObjectOperator::SaveDataObj( std::optional<nlohmann::json> GpgFrontend::DataObjectOperator::GetDataObject( const std::string& _key) { try { - SPDLOG_INFO("get data object {}", _key); + SPDLOG_DEBUG("get data object {}", _key); auto _hash_obj_key = QCryptographicHash::hash(hash_key_ + QByteArray::fromStdString(_key), QCryptographicHash::Sha256) @@ -124,19 +124,19 @@ std::optional<nlohmann::json> GpgFrontend::DataObjectOperator::GetDataObject( return {}; } - SPDLOG_INFO("data object found {}", _key); + SPDLOG_DEBUG("data object found {}", _key); auto encoded = QByteArray::fromStdString(buffer); QAESEncryption encryption(QAESEncryption::AES_256, QAESEncryption::ECB, QAESEncryption::Padding::ISO); - SPDLOG_INFO("decrypting data object {} , hash key size: {}", encoded.size(), - hash_key_.size()); + SPDLOG_DEBUG("decrypting data object {} , hash key size: {}", + encoded.size(), hash_key_.size()); auto decoded = encryption.removePadding(encryption.decode(encoded, hash_key_)); - SPDLOG_INFO("data object decoded: {}", _key); + SPDLOG_DEBUG("data object decoded: {}", _key); return nlohmann::json::parse(decoded.toStdString()); } catch (...) { diff --git a/src/core/function/FileOperator.cpp b/src/core/function/FileOperator.cpp index 3732cd1a..41552246 100644 --- a/src/core/function/FileOperator.cpp +++ b/src/core/function/FileOperator.cpp @@ -94,7 +94,7 @@ std::string GpgFrontend::FileOperator::CalculateHash( auto hash_md5 = QCryptographicHash(QCryptographicHash::Md5); hash_md5.addData(buffer); auto md5 = hash_md5.result().toHex().toStdString(); - SPDLOG_INFO("md5 {}", md5); + SPDLOG_DEBUG("md5 {}", md5); ss << " " << "md5" << _(": ") << md5 << std::endl; @@ -102,7 +102,7 @@ std::string GpgFrontend::FileOperator::CalculateHash( auto hash_sha1 = QCryptographicHash(QCryptographicHash::Sha1); hash_sha1.addData(buffer); auto sha1 = hash_sha1.result().toHex().toStdString(); - SPDLOG_INFO("sha1 {}", sha1); + SPDLOG_DEBUG("sha1 {}", sha1); ss << " " << "sha1" << _(": ") << sha1 << std::endl; @@ -110,7 +110,7 @@ std::string GpgFrontend::FileOperator::CalculateHash( auto hash_sha256 = QCryptographicHash(QCryptographicHash::Sha256); hash_sha256.addData(buffer); auto sha256 = hash_sha256.result().toHex().toStdString(); - SPDLOG_INFO("sha256 {}", sha256); + SPDLOG_DEBUG("sha256 {}", sha256); ss << " " << "sha256" << _(": ") << sha256 << std::endl; diff --git a/src/core/function/GlobalSettingStation.cpp b/src/core/function/GlobalSettingStation.cpp index d9628026..79c47408 100644 --- a/src/core/function/GlobalSettingStation.cpp +++ b/src/core/function/GlobalSettingStation.cpp @@ -34,8 +34,8 @@ void GpgFrontend::GlobalSettingStation::SyncSettings() noexcept { using namespace libconfig; try { ui_cfg_.writeFile(ui_config_path_.u8string().c_str()); - SPDLOG_INFO("updated ui configuration successfully written to {}", - ui_config_path_.u8string()); + SPDLOG_DEBUG("updated ui configuration successfully written to {}", + ui_config_path_.u8string()); } catch (const FileIOException &fioex) { SPDLOG_ERROR("i/o error while writing ui configuration file: {}", @@ -66,18 +66,19 @@ GpgFrontend::GlobalSettingStation::GlobalSettingStation(int channel) noexcept if (!exists(ui_config_path_)) { try { this->ui_cfg_.writeFile(ui_config_path_.u8string().c_str()); - SPDLOG_INFO("userInterface configuration successfully written to {}", - ui_config_path_.u8string()); + SPDLOG_DEBUG("user interface configuration successfully written to {}", + ui_config_path_.u8string()); } catch (const FileIOException &fioex) { - SPDLOG_INFO("i/o error while writing UserInterface configuration file {}", - ui_config_path_.u8string()); + SPDLOG_DEBUG( + "i/o error while writing UserInterface configuration file {}", + ui_config_path_.u8string()); } } else { try { this->ui_cfg_.readFile(ui_config_path_.u8string().c_str()); - SPDLOG_INFO("user interface configuration successfully read from {}", - ui_config_path_.u8string()); + SPDLOG_DEBUG("user interface configuration successfully read from {}", + ui_config_path_.u8string()); } catch (const FileIOException &fioex) { SPDLOG_ERROR("i/o error while reading UserInterface configure file"); } catch (const ParseException &pex) { diff --git a/src/core/function/KeyPackageOperator.cpp b/src/core/function/KeyPackageOperator.cpp index 19c572f8..5c917ab8 100644 --- a/src/core/function/KeyPackageOperator.cpp +++ b/src/core/function/KeyPackageOperator.cpp @@ -39,7 +39,7 @@ namespace GpgFrontend { bool KeyPackageOperator::GeneratePassphrase( const std::filesystem::path& phrase_path, std::string& phrase) { phrase = PassphraseGenerator::GetInstance().Generate(256); - SPDLOG_INFO("generated passphrase: {} bytes", phrase.size()); + SPDLOG_DEBUG("generated passphrase: {} bytes", phrase.size()); return FileOperator::WriteFileStd(phrase_path, phrase); } @@ -47,7 +47,7 @@ bool KeyPackageOperator::GenerateKeyPackage( const std::filesystem::path& key_package_path, const std::string& key_package_name, KeyIdArgsListPtr& key_ids, std::string& phrase, bool secret) { - SPDLOG_INFO("generating key package: {}", key_package_name); + SPDLOG_DEBUG("generating key package: {}", key_package_name); ByteArrayPtr key_export_data = nullptr; if (!GpgKeyImportExporter::GetInstance().ExportAllKeys( @@ -64,7 +64,7 @@ bool KeyPackageOperator::GenerateKeyPackage( QAESEncryption::Padding::ISO); auto encoded = encryption.encode(data, hash_key); - SPDLOG_INFO("writing key package: {}", key_package_name); + SPDLOG_DEBUG("writing key package: {}", key_package_name); return FileOperator::WriteFileStd(key_package_path, encoded.toStdString()); } @@ -72,7 +72,7 @@ bool KeyPackageOperator::ImportKeyPackage( const std::filesystem::path& key_package_path, const std::filesystem::path& phrase_path, GpgFrontend::GpgImportInformation& import_info) { - SPDLOG_INFO("importing key package: {]", key_package_path.u8string()); + SPDLOG_DEBUG("importing key package: {]", key_package_path.u8string()); std::string encrypted_data; FileOperator::ReadFileStd(key_package_path, encrypted_data); @@ -84,7 +84,7 @@ bool KeyPackageOperator::ImportKeyPackage( std::string passphrase; FileOperator::ReadFileStd(phrase_path, passphrase); - SPDLOG_INFO("passphrase: {} bytes", passphrase.size()); + SPDLOG_DEBUG("passphrase: {} bytes", passphrase.size()); if (passphrase.size() != 256) { SPDLOG_ERROR("failed to read passphrase: {}", phrase_path.u8string()); return false; @@ -100,7 +100,7 @@ bool KeyPackageOperator::ImportKeyPackage( auto decoded = encryption.removePadding(encryption.decode(encoded, hash_key)); auto key_data = QByteArray::fromBase64(decoded); - SPDLOG_INFO("key data size: {}", key_data.size()); + SPDLOG_DEBUG("key data size: {}", key_data.size()); if (!key_data.startsWith(GpgConstants::PGP_PUBLIC_KEY_BEGIN) && !key_data.startsWith(GpgConstants::PGP_PRIVATE_KEY_BEGIN)) { return false; diff --git a/src/core/function/gpg/GpgBasicOperator.cpp b/src/core/function/gpg/GpgBasicOperator.cpp index 5f857375..0257afac 100644 --- a/src/core/function/gpg/GpgBasicOperator.cpp +++ b/src/core/function/gpg/GpgBasicOperator.cpp @@ -178,15 +178,15 @@ gpgme_error_t GpgFrontend::GpgBasicOperator::EncryptSign( void GpgFrontend::GpgBasicOperator::SetSigners(KeyArgsList& signers) { gpgme_signers_clear(ctx_); for (const GpgKey& key : signers) { - SPDLOG_INFO("key fpr: {}", key.GetFingerprint()); + SPDLOG_DEBUG("key fpr: {}", key.GetFingerprint()); if (key.IsHasActualSigningCapability()) { - SPDLOG_INFO("signer"); + SPDLOG_DEBUG("signer"); auto error = gpgme_signers_add(ctx_, gpgme_key_t(key)); check_gpg_error(error); } } if (signers.size() != gpgme_signers_count(ctx_)) - SPDLOG_INFO("not all signers added"); + SPDLOG_DEBUG("not all signers added"); } std::unique_ptr<GpgFrontend::KeyArgsList> diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 733bd6ef..844b3694 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -37,12 +37,10 @@ void GpgFrontend::GpgCommandExecutor::Execute( std::string cmd, std::vector<std::string> arguments, std::function<void(int, std::string, std::string)> callback, std::function<void(QProcess *)> interact_func) { - SPDLOG_INFO("called cmd {} arguments size: {}", cmd, arguments.size()); + SPDLOG_DEBUG("called cmd {} arguments size: {}", cmd, arguments.size()); Thread::Task::TaskCallback result_callback = [](int rtn, Thread::Task::DataObjectPtr data_object) { - SPDLOG_INFO("called"); - if (data_object->GetObjectSize() != 4) throw std::runtime_error("invalid data object size"); @@ -75,7 +73,7 @@ void GpgFrontend::GpgCommandExecutor::Execute( cmd_process->setProcessChannelMode(QProcess::MergedChannels); QObject::connect(cmd_process, &QProcess::started, - []() -> void { SPDLOG_INFO("process started"); }); + []() -> void { SPDLOG_DEBUG("process started"); }); QObject::connect( cmd_process, &QProcess::readyReadStandardOutput, [interact_func, cmd_process]() { interact_func(cmd_process); }); @@ -113,7 +111,7 @@ void GpgFrontend::GpgCommandExecutor::Execute( q_arguments.append(QString::fromStdString(argument)); cmd_process->setArguments(q_arguments); - SPDLOG_INFO("process execute ready"); + SPDLOG_DEBUG("process execute ready"); cmd_process->start(); cmd_process->waitForFinished(30); diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp index 0cb418a7..a8e685e0 100644 --- a/src/core/function/gpg/GpgKeyGetter.cpp +++ b/src/core/function/gpg/GpgKeyGetter.cpp @@ -39,13 +39,11 @@ GpgFrontend::GpgKeyGetter::GpgKeyGetter(int channel) : SingletonFunctionObject<GpgKeyGetter>(channel) { - SPDLOG_INFO("called channel: {}", channel); + SPDLOG_DEBUG("called channel: {}", channel); } GpgFrontend::GpgKey GpgFrontend::GpgKeyGetter::GetKey(const std::string& fpr, bool use_cache) { - SPDLOG_INFO("called"); - // find in cache first if (use_cache) { auto key = get_key_in_cache(fpr); @@ -80,19 +78,19 @@ GpgFrontend::KeyLinkListPtr GpgFrontend::GpgKeyGetter::FetchKey() { // get the lock std::lock_guard<std::mutex> lock(keys_cache_mutex_); - SPDLOG_INFO("channel id: {}", GetChannel()); + SPDLOG_DEBUG("channel id: {}", GetChannel()); auto keys_list = std::make_unique<GpgKeyLinkList>(); for (const auto& [key, value] : keys_cache_) { - SPDLOG_INFO("fetch key id: {}", value.GetId()); + SPDLOG_DEBUG("fetch key id: {}", value.GetId()); keys_list->push_back(value.Copy()); } return keys_list; } void GpgFrontend::GpgKeyGetter::FlushKeyCache() { - SPDLOG_INFO("called channel id: {}", GetChannel()); + SPDLOG_DEBUG("called channel id: {}", GetChannel()); // clear the keys cache keys_cache_.clear(); @@ -120,14 +118,14 @@ void GpgFrontend::GpgKeyGetter::FlushKeyCache() { gpg_key = GetKey(gpg_key.GetId(), false); } - SPDLOG_INFO("load key fpr: {} id: {}", gpg_key.GetFingerprint(), - gpg_key.GetId()); + SPDLOG_DEBUG("load key fpr: {} id: {}", gpg_key.GetFingerprint(), + gpg_key.GetId()); keys_cache_.insert({gpg_key.GetId(), std::move(gpg_key)}); } } - SPDLOG_INFO("cache address: {} object address: {}", - static_cast<void*>(&keys_cache_), static_cast<void*>(this)); + SPDLOG_DEBUG("cache address: {} object address: {}", + static_cast<void*>(&keys_cache_), static_cast<void*>(this)); // for debug assert(check_gpg_error_2_err_code(err, GPG_ERR_EOF) == GPG_ERR_EOF); diff --git a/src/core/function/gpg/GpgKeyImportExporter.cpp b/src/core/function/gpg/GpgKeyImportExporter.cpp index 8c66ebe2..81f67e78 100644 --- a/src/core/function/gpg/GpgKeyImportExporter.cpp +++ b/src/core/function/gpg/GpgKeyImportExporter.cpp @@ -93,8 +93,8 @@ bool GpgFrontend::GpgKeyImportExporter::ExportKeys(KeyIdArgsListPtr& uid_list, delete[] keys_array; - SPDLOG_INFO("exportKeys read_bytes: {}", - gpgme_data_seek(data_out, 0, SEEK_END)); + SPDLOG_DEBUG("export keys read_bytes: {}", + gpgme_data_seek(data_out, 0, SEEK_END)); auto temp_out_buffer = data_out.Read2Buffer(); @@ -144,7 +144,7 @@ bool GpgFrontend::GpgKeyImportExporter::ExportAllKeys( */ bool GpgFrontend::GpgKeyImportExporter::ExportSecretKey( const GpgKey& key, ByteArrayPtr& out_buffer) const { - SPDLOG_INFO("export secret key: {}", key.GetId().c_str()); + SPDLOG_DEBUG("export secret key: {}", key.GetId().c_str()); gpgme_key_t target_key[2] = {gpgme_key_t(key), nullptr}; @@ -165,8 +165,8 @@ bool GpgFrontend::GpgKeyImportExporter::ExportKey( GpgData data_out; auto err = gpgme_op_export(ctx_, key.GetId().c_str(), 0, data_out); - SPDLOG_INFO("export keys read_bytes: {}", - gpgme_data_seek(data_out, 0, SEEK_END)); + SPDLOG_DEBUG("export keys read_bytes: {}", + gpgme_data_seek(data_out, 0, SEEK_END)); auto temp_out_buffer = data_out.Read2Buffer(); std::swap(out_buffer, temp_out_buffer); @@ -180,7 +180,7 @@ bool GpgFrontend::GpgKeyImportExporter::ExportKeyOpenSSH( auto err = gpgme_op_export(ctx_, key.GetId().c_str(), GPGME_EXPORT_MODE_SSH, data_out); - SPDLOG_INFO("read_bytes: {}", gpgme_data_seek(data_out, 0, SEEK_END)); + SPDLOG_DEBUG("read_bytes: {}", gpgme_data_seek(data_out, 0, SEEK_END)); auto temp_out_buffer = data_out.Read2Buffer(); std::swap(out_buffer, temp_out_buffer); @@ -194,7 +194,7 @@ bool GpgFrontend::GpgKeyImportExporter::ExportSecretKeyShortest( auto err = gpgme_op_export(ctx_, key.GetId().c_str(), GPGME_EXPORT_MODE_MINIMAL, data_out); - SPDLOG_INFO("read_bytes: {}", gpgme_data_seek(data_out, 0, SEEK_END)); + SPDLOG_DEBUG("read_bytes: {}", gpgme_data_seek(data_out, 0, SEEK_END)); auto temp_out_buffer = data_out.Read2Buffer(); std::swap(out_buffer, temp_out_buffer); diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp index d63afc0d..0d715ba7 100644 --- a/src/core/function/gpg/GpgKeyOpera.cpp +++ b/src/core/function/gpg/GpgKeyOpera.cpp @@ -84,7 +84,7 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::SetExpire( to_time_t(*expires) - system_clock::to_time_t(system_clock::now()); } - SPDLOG_INFO(key.GetId(), subkey_fpr, expires_time); + SPDLOG_DEBUG(key.GetId(), subkey_fpr, expires_time); GpgError err; if (key.GetFingerprint() == subkey_fpr || subkey_fpr.empty()) @@ -116,7 +116,7 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::GenerateKey( const char* userid = userid_utf8.c_str(); auto algo_utf8 = params->GetAlgo() + params->GetKeySizeStr(); - SPDLOG_INFO("params: {} {}", params->GetAlgo(), params->GetKeySizeStr()); + SPDLOG_DEBUG("params: {} {}", params->GetAlgo(), params->GetKeySizeStr()); const char* algo = algo_utf8.c_str(); unsigned long expires = 0; @@ -129,7 +129,7 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::GenerateKey( GpgError err; - SPDLOG_INFO("ctx version, {}", ctx_.GetInfo(false).GnupgVersion); + SPDLOG_DEBUG("ctx version, {}", ctx_.GetInfo(false).GnupgVersion); if (ctx_.GetInfo(false).GnupgVersion >= "2.1.0") { unsigned int flags = 0; @@ -141,7 +141,7 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::GenerateKey( if (params->IsNonExpired()) flags |= GPGME_CREATE_NOEXPIRE; if (params->IsNoPassPhrase()) flags |= GPGME_CREATE_NOPASSWD; - SPDLOG_INFO("args: {}", userid, algo, expires, flags); + SPDLOG_DEBUG("args: {}", userid, algo, expires, flags); err = gpgme_op_createkey(ctx_, userid, algo, 0, expires, nullptr, flags); @@ -170,7 +170,7 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::GenerateKey( ss << "</GnupgKeyParms>"; - SPDLOG_INFO("params: {}", ss.str()); + SPDLOG_DEBUG("params: {}", ss.str()); err = gpgme_op_genkey(ctx_, ss.str().c_str(), nullptr, nullptr); } @@ -193,8 +193,8 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::GenerateSubkey( const GpgKey& key, const std::unique_ptr<GenKeyInfo>& params) { if (!params->IsSubKey()) return GPG_ERR_CANCELED; - SPDLOG_INFO("generate subkey algo {} key size {}", params->GetAlgo(), - params->GetKeySizeStr()); + SPDLOG_DEBUG("generate subkey algo {} key size {}", params->GetAlgo(), + params->GetKeySizeStr()); auto algo_utf8 = (params->GetAlgo() + params->GetKeySizeStr()); const char* algo = algo_utf8.c_str(); @@ -214,8 +214,7 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::GenerateSubkey( if (params->IsNonExpired()) flags |= GPGME_CREATE_NOEXPIRE; if (params->IsNoPassPhrase()) flags |= GPGME_CREATE_NOPASSWD; - SPDLOG_INFO("GpgFrontend::GpgKeyOpera::GenerateSubkey args: {} {} {} {}", - key.GetId(), algo, expires, flags); + SPDLOG_DEBUG("args: {} {} {} {}", key.GetId(), algo, expires, flags); auto err = gpgme_op_createsubkey(ctx_, gpgme_key_t(key), algo, 0, expires, flags); diff --git a/src/core/function/gpg/GpgUIDOperator.cpp b/src/core/function/gpg/GpgUIDOperator.cpp index 5b92b86d..7e7a711e 100644 --- a/src/core/function/gpg/GpgUIDOperator.cpp +++ b/src/core/function/gpg/GpgUIDOperator.cpp @@ -65,7 +65,7 @@ bool GpgFrontend::GpgUIDOperator::AddUID(const GpgFrontend::GpgKey& key, const std::string& name, const std::string& comment, const std::string& email) { - SPDLOG_INFO("GpgFrontend::UidOperator::AddUID", name, comment, email); + SPDLOG_DEBUG("new uuid: {} {} {}", name, comment, email); auto uid = boost::format("%1%(%2%)<%3%>") % name % comment % email; return AddUID(key, uid.str()); } diff --git a/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp b/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp index a468e583..21d37eab 100644 --- a/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp @@ -33,7 +33,7 @@ GpgFrontend::GpgEncryptResultAnalyse::GpgEncryptResultAnalyse( : error_(error), result_(std::move(result)) {} void GpgFrontend::GpgEncryptResultAnalyse::do_analyse() { - SPDLOG_INFO("start encrypt result analyse"); + SPDLOG_DEBUG("start encrypt result analyse"); stream_ << "[#] " << _("Encrypt Operation") << " "; diff --git a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp index 1660d08b..e4d1354f 100644 --- a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp @@ -35,7 +35,7 @@ GpgFrontend::GpgSignResultAnalyse::GpgSignResultAnalyse(GpgError error, : error_(error), result_(std::move(result)) {} void GpgFrontend::GpgSignResultAnalyse::do_analyse() { - SPDLOG_INFO("start sign result analyse"); + SPDLOG_DEBUG("start sign result analyse"); stream_ << "[#] " << _("Sign Operation") << " "; @@ -49,14 +49,14 @@ void GpgFrontend::GpgSignResultAnalyse::do_analyse() { if (result_ != nullptr && (result_->signatures != nullptr || result_->invalid_signers != nullptr)) { - SPDLOG_INFO("sign result analyse getting result"); + SPDLOG_DEBUG("sign result analyse getting result"); stream_ << "------------>" << std::endl; auto new_sign = result_->signatures; while (new_sign != nullptr) { stream_ << "[>]" << _("New Signature") << ": " << std::endl; - SPDLOG_INFO("signers fingerprint: ", new_sign->fpr); + SPDLOG_DEBUG("signers fingerprint: ", new_sign->fpr); stream_ << " " << _("Sign Mode") << ": "; if (new_sign->type == GPGME_SIG_MODE_NORMAL) @@ -92,7 +92,7 @@ void GpgFrontend::GpgSignResultAnalyse::do_analyse() { new_sign = new_sign->next; } - SPDLOG_INFO("sign result analyse getting invalid signer"); + SPDLOG_DEBUG("sign result analyse getting invalid signer"); auto invalid_signer = result_->invalid_signers; diff --git a/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp b/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp index d246900e..b19db5b2 100644 --- a/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp @@ -39,7 +39,7 @@ GpgFrontend::GpgVerifyResultAnalyse::GpgVerifyResultAnalyse( : error_(error), result_(std::move(result)) {} void GpgFrontend::GpgVerifyResultAnalyse::do_analyse() { - SPDLOG_INFO("started"); + SPDLOG_DEBUG("started"); stream_ << "[#] " << _("Verify Operation") << " "; diff --git a/src/core/thread/FileReadTask.cpp b/src/core/thread/FileReadTask.cpp index 1ac23a89..0f7d11c3 100644 --- a/src/core/thread/FileReadTask.cpp +++ b/src/core/thread/FileReadTask.cpp @@ -46,7 +46,7 @@ void FileReadTask::Run() { SetFinishAfterRun(false); if (is_regular_file(read_file_path_)) { - SPDLOG_INFO("read open file: {}", read_file_path_.u8string()); + SPDLOG_DEBUG("read open file: {}", read_file_path_.u8string()); target_file_.setFileName( QString::fromStdString(read_file_path_.u8string())); @@ -57,7 +57,7 @@ void FileReadTask::Run() { if (target_file_.isOpen()) target_file_.close(); return; } - SPDLOG_INFO("started reading: {}", read_file_path_.u8string()); + SPDLOG_DEBUG("started reading: {}", read_file_path_.u8string()); read_bytes(); } else { emit SignalFileBytesReadEnd(); @@ -68,10 +68,10 @@ void FileReadTask::read_bytes() { QByteArray read_buffer; if (!target_file_.atEnd() && (read_buffer = target_file_.read(buffer_size_)).size() > 0) { - SPDLOG_INFO("read bytes: {}", read_buffer.size()); + SPDLOG_DEBUG("read bytes: {}", read_buffer.size()); emit SignalFileBytesRead(std::move(read_buffer)); } else { - SPDLOG_INFO("read bytes end"); + SPDLOG_DEBUG("read bytes end"); emit SignalFileBytesReadEnd(); // finish task emit SignalTaskFinished(); @@ -79,7 +79,7 @@ void FileReadTask::read_bytes() { } FileReadTask::~FileReadTask() { - SPDLOG_INFO("close file: {}", read_file_path_.u8string()); + SPDLOG_DEBUG("close file: {}", read_file_path_.u8string()); if (target_file_.isOpen()) target_file_.close(); } diff --git a/src/core/thread/Task.h b/src/core/thread/Task.h index 413a54fd..d9a70618 100644 --- a/src/core/thread/Task.h +++ b/src/core/thread/Task.h @@ -78,7 +78,7 @@ class GPGFRONTEND_CORE_EXPORT Task : public QObject, public QRunnable { */ template <typename T> void AppendObject(T &&obj) { - SPDLOG_TRACE("called: {}", static_cast<void *>(this)); + SPDLOG_TRACE("append object: {}", static_cast<void *>(this)); auto *obj_dstr = this->get_heap_ptr(sizeof(T)); new ((void *)obj_dstr->p_obj) T(std::forward<T>(obj)); @@ -125,7 +125,7 @@ class GPGFRONTEND_CORE_EXPORT Task : public QObject, public QRunnable { */ template <typename T> T PopObject() { - SPDLOG_TRACE("called: {}", static_cast<void *>(this)); + SPDLOG_TRACE("pop object: {}", static_cast<void *>(this)); if (data_objects_.empty()) throw std::runtime_error("No object to pop"); auto *obj_dstr = data_objects_.top(); auto *heap_ptr = (T *)obj_dstr->p_obj; diff --git a/src/core/thread/TaskRunner.cpp b/src/core/thread/TaskRunner.cpp index 75fc5d88..dc6ac385 100644 --- a/src/core/thread/TaskRunner.cpp +++ b/src/core/thread/TaskRunner.cpp @@ -65,7 +65,7 @@ void GpgFrontend::Thread::TaskRunner::PostScheduleTask(Task* task, } [[noreturn]] void GpgFrontend::Thread::TaskRunner::run() { - SPDLOG_TRACE("called, thread id: {}", QThread::currentThreadId()); + SPDLOG_TRACE("run, thread id: {}", QThread::currentThreadId()); while (true) { SPDLOG_TRACE("task runner: a new cycle start"); if (tasks.empty()) { diff --git a/src/main.cpp b/src/main.cpp index 8243c068..38c17d2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -145,8 +145,8 @@ int main(int argc, char* argv[]) { return_from_event_loop_code = CRASH_CODE; } - SPDLOG_INFO("restart loop refresh, event loop code: {}", - return_from_event_loop_code); + SPDLOG_DEBUG("restart loop refresh, event loop code: {}", + return_from_event_loop_code); } while (return_from_event_loop_code == RESTART_CODE); if (return_from_event_loop_code == DEEP_RESTART_CODE || @@ -154,11 +154,11 @@ int main(int argc, char* argv[]) { // reset core GpgFrontend::ResetGpgFrontendCore(); // log for debug - SPDLOG_INFO("deep restart or cash loop refresh"); + SPDLOG_DEBUG("deep restart or cash loop refresh"); } else { // log for debug - SPDLOG_INFO("need to close application, event loop code: {}", - return_from_event_loop_code); + SPDLOG_DEBUG("need to close application, event loop code: {}", + return_from_event_loop_code); } // deep restart mode @@ -166,7 +166,7 @@ int main(int argc, char* argv[]) { return_from_event_loop_code == CRASH_CODE); // log for debug - SPDLOG_INFO("GpgFrontend about to exit"); + SPDLOG_INFO("GpgFrontend about to exit."); // exit the program return return_from_event_loop_code; diff --git a/src/signal.cpp b/src/signal.cpp index 424b97d5..09ac48c0 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -43,7 +43,7 @@ extern jmp_buf recover_env; */ void handle_signal(int sig) { static int _repeat_handle_num = 1, last_sig = sig; - SPDLOG_INFO("signal caught {}", sig); + SPDLOG_DEBUG("signal caught {}", sig); if (last_sig == sig) _repeat_handle_num++; @@ -51,7 +51,7 @@ void handle_signal(int sig) { _repeat_handle_num = 1, last_sig = sig; if (_repeat_handle_num > 3) { - SPDLOG_INFO( + SPDLOG_DEBUG( "The same signal appears three times, execute the termination " "operation. "); exit(-1); diff --git a/src/ui/GpgFrontendApplication.cpp b/src/ui/GpgFrontendApplication.cpp index b5cda19f..1b2bb9ad 100644 --- a/src/ui/GpgFrontendApplication.cpp +++ b/src/ui/GpgFrontendApplication.cpp @@ -72,7 +72,7 @@ bool GpgFrontendApplication::notify(QObject *receiver, QEvent *event) { try { app_done = QApplication::notify(receiver, event); } catch (const std::exception &ex) { - SPDLOG_INFO("exception caught in notify: {}", ex.what()); + SPDLOG_ERROR("exception caught in notify: {}", ex.what()); QMessageBox::information(nullptr, _("Standard Exception Thrown"), _("Oops, an standard exception was thrown " "during the running of the " @@ -80,7 +80,7 @@ bool GpgFrontendApplication::notify(QObject *receiver, QEvent *event) { "be the negligence of the programmer, " "please report this problem if you can.")); } catch (...) { - SPDLOG_INFO("unknown exception caught in notify"); + SPDLOG_ERROR("unknown exception caught in notify"); QMessageBox::information( nullptr, _("Unhandled Exception Thrown"), _("Oops, an unhandled exception was thrown " diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index c4c6bacd..09e01ea9 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -92,13 +92,13 @@ void InitGpgFrontendUI(QApplication* app) { waiting_dialog->resize(420, 120); app->connect(init_ctx_task, &Thread::CtxCheckTask::SignalTaskFinished, waiting_dialog, [=]() { - SPDLOG_INFO("gpg context loaded"); + SPDLOG_DEBUG("gpg context loaded"); waiting_dialog->finished(0); waiting_dialog->deleteLater(); }); app->connect(waiting_dialog, &QProgressDialog::canceled, [=]() { - SPDLOG_INFO("cancel clicked"); + SPDLOG_DEBUG("cancel clicked"); app->quit(); exit(0); }); @@ -125,7 +125,7 @@ int RunGpgFrontendUI(QApplication* app) { // create main window and show it auto main_window = std::make_unique<GpgFrontend::UI::MainWindow>(); main_window->Init(); - SPDLOG_INFO("main window inited"); + SPDLOG_DEBUG("main window inited"); main_window->show(); // start the main event loop return app->exec(); diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp index 7ab5469a..408a1c04 100644 --- a/src/ui/UserInterfaceUtils.cpp +++ b/src/ui/UserInterfaceUtils.cpp @@ -74,7 +74,7 @@ void import_unknown_key_from_keyserver( auto key_ids = std::make_unique<KeyIdArgsList>(); auto *signature = verify_res.GetSignatures(); while (signature != nullptr) { - SPDLOG_INFO("signature fpr: {}", signature->fpr); + SPDLOG_DEBUG("signature fpr: {}", signature->fpr); key_ids->push_back(signature->fpr); signature = signature->next; } @@ -105,8 +105,6 @@ void process_result_analyse(TextEdit *edit, InfoBoardWidget *info_board, void process_result_analyse(TextEdit *edit, InfoBoardWidget *info_board, const GpgResultAnalyse &result_analyse_a, const GpgResultAnalyse &result_analyse_b) { - SPDLOG_INFO("process_result_analyse Started"); - info_board->AssociateTabWidget(edit->tab_widget_); refresh_info_board( @@ -150,8 +148,6 @@ CommonUtils *CommonUtils::GetInstance() { } CommonUtils::CommonUtils() : QWidget(nullptr) { - SPDLOG_INFO("common utils created"); - connect(CoreCommonUtil::GetInstance(), &CoreCommonUtil::SignalGnupgNotInstall, this, &CommonUtils::SignalGnupgNotInstall); connect(this, &CommonUtils::SignalKeyStatusUpdated, @@ -234,7 +230,7 @@ void CommonUtils::SlotExecuteCommand( &QEventLoop::quit); connect(cmd_process, &QProcess::errorOccurred, &looper, &QEventLoop::quit); connect(cmd_process, &QProcess::started, - []() -> void { SPDLOG_INFO("process started"); }); + []() -> void { SPDLOG_DEBUG("process started"); }); connect(cmd_process, &QProcess::readyReadStandardOutput, [interact_func, cmd_process]() { interact_func(cmd_process); }); connect(cmd_process, &QProcess::errorOccurred, this, @@ -243,7 +239,7 @@ void CommonUtils::SlotExecuteCommand( qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, [=](int, QProcess::ExitStatus status) { if (status == QProcess::NormalExit) - SPDLOG_INFO("succeed in executing command: {}", cmd); + SPDLOG_DEBUG("succeed in executing command: {}", cmd); else SPDLOG_WARN("error in executing command: {}", cmd); }); @@ -271,7 +267,7 @@ void CommonUtils::SlotExecuteGpgCommand( &WaitingDialog::deleteLater); connect(gpg_process, &QProcess::errorOccurred, &looper, &QEventLoop::quit); connect(gpg_process, &QProcess::started, - []() -> void { SPDLOG_INFO("gpg process started"); }); + []() -> void { SPDLOG_DEBUG("gpg process started"); }); connect(gpg_process, &QProcess::readyReadStandardOutput, [interact_func, gpg_process]() { interact_func(gpg_process); }); connect(gpg_process, &QProcess::errorOccurred, this, [=]() -> void { @@ -325,8 +321,8 @@ void CommonUtils::SlotImportKeyFromKeyServer( target_keyserver = key_server_list[target_key_server_index].get<std::string>(); - SPDLOG_INFO("set target key server to default Key Server: {}", - target_keyserver); + SPDLOG_DEBUG("set target key server to default Key Server: {}", + target_keyserver); } catch (...) { SPDLOG_ERROR(_("Cannot read default_keyserver From Settings")); QMessageBox::critical( @@ -349,7 +345,7 @@ void CommonUtils::SlotImportKeyFromKeyServer( target_keyserver_url.scheme() + "://" + target_keyserver_url.host() + "/pks/lookup?op=get&search=0x" + key_id.c_str() + "&options=mr"); - SPDLOG_INFO("request url: {}", req_url.toString().toStdString()); + SPDLOG_DEBUG("request url: {}", req_url.toString().toStdString()); // Waiting for reply QNetworkReply *reply = network_manager->get(QNetworkRequest(req_url)); @@ -402,8 +398,6 @@ void CommonUtils::SlotImportKeyFromKeyServer( } void CommonUtils::slot_update_key_status() { - SPDLOG_INFO("called"); - auto refresh_task = new Thread::Task([](Thread::Task::DataObjectPtr) -> int { // flush key cache for all GpgKeyGetter Intances. for (const auto &channel_id : GpgKeyGetter::GetAllChannelId()) { @@ -420,8 +414,6 @@ void CommonUtils::slot_update_key_status() { } void CommonUtils::slot_popup_passphrase_input_dialog() { - SPDLOG_INFO("called"); - auto *dialog = new QInputDialog(QApplication::activeWindow(), Qt::Dialog); dialog->setModal(true); dialog->setWindowTitle(_("Password Input Dialog")); diff --git a/src/ui/dialog/GeneralDialog.cpp b/src/ui/dialog/GeneralDialog.cpp index 69138dbd..9367aa44 100644 --- a/src/ui/dialog/GeneralDialog.cpp +++ b/src/ui/dialog/GeneralDialog.cpp @@ -39,8 +39,6 @@ GpgFrontend::UI::GeneralDialog::~GeneralDialog() = default; void GpgFrontend::UI::GeneralDialog::slot_restore_settings() noexcept { try { - SPDLOG_INFO(name_, _("Called")); - SettingsObject general_windows_state(name_ + "_dialog_state"); bool window_save = general_windows_state.Check("window_save", true); @@ -81,13 +79,13 @@ void GpgFrontend::UI::GeneralDialog::slot_restore_settings() noexcept { parent_size = parent_window->size(); } - SPDLOG_INFO("parent pos x: {} y: {}", parent_pos.x(), parent_pos.y()); + SPDLOG_DEBUG("parent pos x: {} y: {}", parent_pos.x(), parent_pos.y()); - SPDLOG_INFO("parent size width: {} height: {}", parent_size.width(), - parent_size.height()); + SPDLOG_DEBUG("parent size width: {} height: {}", parent_size.width(), + parent_size.height()); - SPDLOG_INFO("this dialog size width: {} height: {}", size_.width(), - size_.height()); + SPDLOG_DEBUG("this dialog size width: {} height: {}", size_.width(), + size_.height()); if (parent_pos != QPoint{0, 0}) { QPoint parent_center{parent_pos.x() + parent_size.width() / 2, @@ -137,7 +135,8 @@ void GpgFrontend::UI::GeneralDialog::setPosCenterOfScreen() { int screen_width = geo.width(); int screen_height = geo.height(); - SPDLOG_INFO("primary screen available geometry", screen_width, screen_height); + SPDLOG_DEBUG("primary screen available geometry", screen_width, + screen_height); pos_ = QPoint((screen_width - QWidget::width()) / 2, (screen_height - QWidget::height()) / 2); @@ -149,13 +148,13 @@ void GpgFrontend::UI::GeneralDialog::setPosCenterOfScreen() { * */ void GpgFrontend::UI::GeneralDialog::movePosition2CenterOfParent() { - SPDLOG_INFO("parent pos x: {} y: {}", parent_pos_.x(), parent_pos_.y()); + SPDLOG_DEBUG("parent pos x: {} y: {}", parent_pos_.x(), parent_pos_.y()); - SPDLOG_INFO("parent size width: {}", parent_size_.width(), - "height:", parent_size_.height()); + SPDLOG_DEBUG("parent size width: {}", parent_size_.width(), + "height:", parent_size_.height()); if (parent_pos_ != QPoint{0, 0} && parent_size_ != QSize{0, 0}) { - SPDLOG_INFO("update current dialog position now"); + SPDLOG_DEBUG("update current dialog position now"); QPoint parent_center{parent_pos_.x() + parent_size_.width() / 2, parent_pos_.y() + parent_size_.height() / 2}; diff --git a/src/ui/dialog/WaitingDialog.cpp b/src/ui/dialog/WaitingDialog.cpp index f014ac3d..afdd55b8 100644 --- a/src/ui/dialog/WaitingDialog.cpp +++ b/src/ui/dialog/WaitingDialog.cpp @@ -57,8 +57,8 @@ WaitingDialog::WaitingDialog(const QString& title, QWidget* parent) int screen_width = geo.width(); int screen_height = geo.height(); - SPDLOG_INFO("primary screen available geometry: {} {}", screen_width, - screen_height); + SPDLOG_DEBUG("primary screen available geometry: {} {}", screen_width, + screen_height); auto pos = QPoint((screen_width - QWidget::width()) / 2, (screen_height - QWidget::height()) / 2); @@ -67,7 +67,7 @@ WaitingDialog::WaitingDialog(const QString& title, QWidget* parent) } else { auto pos = QPoint(parent->x() + (parent->width() - QWidget::width()) / 2, parent->y() + (parent->height() - QWidget::height()) / 2); - SPDLOG_INFO("pos: {} {}", pos.x(), pos.y()); + SPDLOG_DEBUG("pos: {} {}", pos.x(), pos.y()); this->move(pos); } diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp index 1a18a0b3..57aefcfb 100644 --- a/src/ui/dialog/Wizard.cpp +++ b/src/ui/dialog/Wizard.cpp @@ -60,7 +60,6 @@ Wizard::Wizard(QWidget* parent) : QWizard(parent) { } void Wizard::slot_wizard_accepted() { - SPDLOG_INFO("called"); // Don't show is mapped to show -> negation try { auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); @@ -223,7 +222,6 @@ KeyGenPage::KeyGenPage(QWidget* parent) : QWizardPage(parent) { int KeyGenPage::nextId() const { return Wizard::Page_Conclusion; } void KeyGenPage::slot_generate_key_dialog() { - SPDLOG_INFO("try opening KeyGenDialog"); (new KeyGenDialog(this))->show(); wizard()->next(); } diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index 2b5ef099..3cf6c2a2 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -52,7 +52,7 @@ AboutDialog::AboutDialog(int defaultIndex, QWidget* parent) tab_widget->addTab(update_tab_, _("Update")); connect(tab_widget, &QTabWidget::currentChanged, this, - [&](int index) { SPDLOG_INFO("current index: {}", index); }); + [&](int index) { SPDLOG_DEBUG("current index: {}", index); }); if (defaultIndex < tab_widget->count() && defaultIndex >= 0) { tab_widget->setCurrentIndex(defaultIndex); @@ -203,7 +203,7 @@ UpdateTab::UpdateTab(QWidget* parent) : QWidget(parent) { void UpdateTab::getLatestVersion() { this->pb_->setHidden(false); - SPDLOG_INFO("try to get latest version"); + SPDLOG_DEBUG("try to get latest version"); auto* version_task = new VersionCheckTask(); diff --git a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp index 7a8ec0ed..e9b1af93 100644 --- a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp +++ b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp @@ -129,8 +129,6 @@ void KeyImportDetailDialog::create_general_info_box() { } void KeyImportDetailDialog::create_keys_table() { - SPDLOG_INFO("KeyImportDetailDialog::create_keys_table() Called"); - keys_table_ = new QTableWidget(this); keys_table_->setRowCount(0); keys_table_->setColumnCount(4); diff --git a/src/ui/dialog/import_export/KeyServerImportDialog.cpp b/src/ui/dialog/import_export/KeyServerImportDialog.cpp index 3668fa70..713c5a58 100644 --- a/src/ui/dialog/import_export/KeyServerImportDialog.cpp +++ b/src/ui/dialog/import_export/KeyServerImportDialog.cpp @@ -253,8 +253,7 @@ void KeyServerImportDialog::slot_search() { void KeyServerImportDialog::slot_search_finished( QNetworkReply::NetworkError error, QByteArray buffer) { - SPDLOG_INFO("called {} {}", error, buffer.size()); - SPDLOG_INFO(buffer.toStdString()); + SPDLOG_DEBUG("search result {} {}", error, buffer.size()); keys_table_->clearContents(); keys_table_->setRowCount(0); @@ -262,7 +261,7 @@ void KeyServerImportDialog::slot_search_finished( auto stream = QTextStream(buffer); if (error != QNetworkReply::NoError) { - SPDLOG_INFO("error from reply: {}", error); + SPDLOG_DEBUG("error from reply: {}", error); switch (error) { case QNetworkReply::ContentNotFoundError: @@ -475,8 +474,6 @@ void KeyServerImportDialog::SlotImport(std::vector<std::string> key_ids, void KeyServerImportDialog::slot_import_finished( QNetworkReply::NetworkError error, QByteArray buffer) { - SPDLOG_INFO("called"); - if (error != QNetworkReply::NoError) { SPDLOG_ERROR("Error From Reply", buffer.toStdString()); if (!m_automatic_) { diff --git a/src/ui/dialog/import_export/KeyUploadDialog.cpp b/src/ui/dialog/import_export/KeyUploadDialog.cpp index d8d2515e..5e05da2d 100644 --- a/src/ui/dialog/import_export/KeyUploadDialog.cpp +++ b/src/ui/dialog/import_export/KeyUploadDialog.cpp @@ -86,8 +86,8 @@ void KeyUploadDialog::slot_upload_key_to_server( target_keyserver = key_server_list[default_key_server_index].get<std::string>(); - SPDLOG_INFO("set target key server to default key server: {}", - target_keyserver); + SPDLOG_DEBUG("set target key server to default key server: {}", + target_keyserver); } catch (...) { SPDLOG_ERROR(_("Cannot read default_keyserver From Settings")); @@ -137,11 +137,11 @@ void KeyUploadDialog::slot_upload_finished() { auto* reply = qobject_cast<QNetworkReply*>(sender()); QByteArray response = reply->readAll(); - SPDLOG_INFO("response: {}", response.toStdString()); + SPDLOG_DEBUG("response: {}", response.toStdString()); auto error = reply->error(); if (error != QNetworkReply::NoError) { - SPDLOG_INFO("error from reply: {}", reply->errorString().toStdString()); + SPDLOG_DEBUG("error from reply: {}", reply->errorString().toStdString()); QString message; switch (error) { case QNetworkReply::ContentNotFoundError: @@ -161,7 +161,7 @@ void KeyUploadDialog::slot_upload_finished() { } else { QMessageBox::information(this, _("Upload Success"), _("Upload Public Key Successfully")); - SPDLOG_INFO("success while contacting keyserver!"); + SPDLOG_DEBUG("success while contacting keyserver!"); } reply->deleteLater(); } diff --git a/src/ui/dialog/key_generate/KeygenDialog.cpp b/src/ui/dialog/key_generate/KeygenDialog.cpp index 346ac802..d6f61215 100644 --- a/src/ui/dialog/key_generate/KeygenDialog.cpp +++ b/src/ui/dialog/key_generate/KeygenDialog.cpp @@ -47,7 +47,7 @@ KeyGenDialog::KeyGenDialog(QWidget* parent) bool longer_expiration_date = false; try { longer_expiration_date = settings.lookup("general.longer_expiration_date"); - SPDLOG_INFO("longer_expiration_date: {}", longer_expiration_date); + SPDLOG_DEBUG("longer_expiration_date: {}", longer_expiration_date); } catch (...) { SPDLOG_ERROR("setting operation error: longer_expiration_date"); @@ -164,7 +164,7 @@ void KeyGenDialog::slot_key_gen_accept() { CoreCommonUtil::GetInstance()->ResetTempCacheValue("__key_passphrase"); } - SPDLOG_INFO("generate done"); + SPDLOG_DEBUG("generate done"); if (gpgme_err_code(error) == GPG_ERR_NO_ERROR) { auto* msg_box = new QMessageBox((QWidget*)this->parent()); @@ -175,7 +175,7 @@ void KeyGenDialog::slot_key_gen_accept() { msg_box->setModal(true); msg_box->open(); - SPDLOG_INFO("generate success"); + SPDLOG_DEBUG("generate success"); emit SignalKeyGenerated(); this->close(); @@ -271,7 +271,7 @@ void KeyGenDialog::slot_authentication_box_changed(int state) { } void KeyGenDialog::slot_activated_key_type(int index) { - SPDLOG_INFO("key type index changed: {}", index); + SPDLOG_DEBUG("key type index changed: {}", index); // check assert(gen_key_info_->GetSupportedKeyAlgo().size() > index); @@ -280,8 +280,6 @@ void KeyGenDialog::slot_activated_key_type(int index) { } void KeyGenDialog::refresh_widgets_state() { - SPDLOG_INFO("refresh_widgets_state called"); - if (gen_key_info_->IsAllowEncryption()) key_usage_check_boxes_[0]->setCheckState(Qt::CheckState::Checked); else diff --git a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp index d8b0907a..50f38413 100644 --- a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp +++ b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp @@ -46,7 +46,7 @@ SubkeyGenerateDialog::SubkeyGenerateDialog(const KeyId& key_id, QWidget* parent) bool longer_expiration_date = false; try { longer_expiration_date = settings.lookup("general.longer_expiration_date"); - SPDLOG_INFO("longer expiration date: {}", longer_expiration_date); + SPDLOG_DEBUG("longer expiration date: {}", longer_expiration_date); } catch (...) { SPDLOG_ERROR("setting operation error: longer_expiration_date"); @@ -208,8 +208,6 @@ void SubkeyGenerateDialog::slot_expire_box_changed() { } void SubkeyGenerateDialog::refresh_widgets_state() { - SPDLOG_INFO("refresh_widgets_state called"); - if (gen_key_info_->IsAllowEncryption()) key_usage_check_boxes_[0]->setCheckState(Qt::CheckState::Checked); else @@ -294,8 +292,9 @@ void SubkeyGenerateDialog::slot_key_gen_accept() { } GpgError error; + // TODO: remove plain qt thread usage auto thread = QThread::create([&]() { - SPDLOG_INFO("thread started"); + SPDLOG_DEBUG("thread started"); error = GpgKeyOpera::GetInstance().GenerateSubkey(key_, gen_key_info_); }); thread->start(); @@ -374,7 +373,7 @@ void SubkeyGenerateDialog::slot_authentication_box_changed(int state) { } void SubkeyGenerateDialog::slot_activated_key_type(int index) { - SPDLOG_INFO("key type index changed: {}", index); + SPDLOG_DEBUG("key type index changed: {}", index); // check assert(gen_key_info_->GetSupportedSubkeyAlgo().size() > index); diff --git a/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp b/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp index cd614cc1..2785603b 100644 --- a/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp @@ -35,8 +35,8 @@ namespace GpgFrontend::UI { KeyPairDetailTab::KeyPairDetailTab(const std::string& key_id, QWidget* parent) : QWidget(parent), key_(GpgKeyGetter::GetInstance().GetKey(key_id)) { - SPDLOG_INFO(key_.GetEmail(), key_.IsPrivateKey(), key_.IsHasMasterKey(), - key_.GetSubKeys()->front().IsPrivateKey()); + SPDLOG_DEBUG(key_.GetEmail(), key_.IsPrivateKey(), key_.IsHasMasterKey(), + key_.GetSubKeys()->front().IsPrivateKey()); owner_box_ = new QGroupBox(_("Owner")); key_box_ = new QGroupBox(_("Primary Key")); @@ -284,8 +284,6 @@ void KeyPairDetailTab::slot_refresh_key_info() { } void KeyPairDetailTab::slot_refresh_key() { - SPDLOG_INFO("called"); - // refresh the key GpgKey refreshed_key = GpgKeyGetter::GetInstance().GetKey(key_.GetId()); std::swap(this->key_, refreshed_key); diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp index 5755d2c2..a1452033 100644 --- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp @@ -296,7 +296,7 @@ void KeyPairOperaTab::slot_gen_revoke_cert() { // Code From Gpg4Win while (proc->canReadLine()) { const QString line = QString::fromUtf8(proc->readLine()).trimmed(); - SPDLOG_INFO("line: {}", line.toStdString()); + SPDLOG_DEBUG("line: {}", line.toStdString()); if (line == QLatin1String("[GNUPG:] GET_BOOL gen_revoke.okay")) { proc->write("y\n"); } else if (line == QLatin1String("[GNUPG:] GET_LINE " @@ -336,7 +336,7 @@ void KeyPairOperaTab::slot_modify_tofu_policy() { this, _("Modify TOFU Policy(Default is Auto)"), _("Policy for the Key Pair:"), items, 0, false, &ok); if (ok && !item.isEmpty()) { - SPDLOG_INFO("selected policy: {}", item.toStdString()); + SPDLOG_DEBUG("selected policy: {}", item.toStdString()); gpgme_tofu_policy_t tofu_policy = GPGME_TOFU_POLICY_AUTO; if (item == _("Policy Auto")) { tofu_policy = GPGME_TOFU_POLICY_AUTO; diff --git a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp index cc57ea4d..d1367541 100644 --- a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp @@ -35,8 +35,8 @@ namespace GpgFrontend::UI { KeyPairSubkeyTab::KeyPairSubkeyTab(const std::string& key_id, QWidget* parent) : QWidget(parent), key_(GpgKeyGetter::GetInstance().GetKey(key_id)) { - SPDLOG_INFO(key_.GetEmail(), key_.IsPrivateKey(), key_.IsHasMasterKey(), - key_.GetSubKeys()->front().IsPrivateKey()); + SPDLOG_DEBUG(key_.GetEmail(), key_.IsPrivateKey(), key_.IsHasMasterKey(), + key_.GetSubKeys()->front().IsPrivateKey()); create_subkey_list(); create_subkey_opera_menu(); @@ -165,7 +165,6 @@ void KeyPairSubkeyTab::create_subkey_list() { } void KeyPairSubkeyTab::slot_refresh_subkey_list() { - SPDLOG_INFO("called"); int row = 0; subkey_list_->setSelectionMode(QAbstractItemView::SingleSelection); @@ -177,8 +176,8 @@ void KeyPairSubkeyTab::slot_refresh_subkey_list() { this->buffered_subkeys_.push_back(std::move(sub_key)); } - SPDLOG_INFO("buffered_subkeys_ refreshed size", - this->buffered_subkeys_.size()); + SPDLOG_DEBUG("buffered_subkeys_ refreshed size", + this->buffered_subkeys_.size()); subkey_list_->setRowCount(buffered_subkeys_.size()); @@ -215,18 +214,16 @@ void KeyPairSubkeyTab::slot_refresh_subkey_list() { } } - SPDLOG_INFO("subkey_list_ item {} refreshed", row); + SPDLOG_DEBUG("subkey_list_ item {} refreshed", row); row++; } - SPDLOG_INFO("subkey_list_ refreshed"); + SPDLOG_DEBUG("subkey_list_ refreshed"); if (subkey_list_->rowCount() > 0) { subkey_list_->selectRow(0); } - - SPDLOG_INFO("slot_refresh_subkey_list ended"); } void KeyPairSubkeyTab::slot_add_subkey() { @@ -328,7 +325,7 @@ void KeyPairSubkeyTab::create_subkey_opera_menu() { } void KeyPairSubkeyTab::slot_edit_subkey() { - SPDLOG_INFO("fpr {}", get_selected_subkey().GetFingerprint()); + SPDLOG_DEBUG("fpr {}", get_selected_subkey().GetFingerprint()); auto dialog = new KeySetExpireDateDialog( key_.GetId(), get_selected_subkey().GetFingerprint(), this); @@ -354,7 +351,6 @@ const GpgSubKey& KeyPairSubkeyTab::get_selected_subkey() { return buffered_subkeys_[row]; } void KeyPairSubkeyTab::slot_refresh_key_info() { - SPDLOG_INFO("called"); key_ = GpgKeyGetter::GetInstance().GetKey(key_.GetId()); } diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp index 1cb49bb5..d55e44d8 100644 --- a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp @@ -225,7 +225,7 @@ void KeyPairUIDTab::slot_refresh_tofu_info() { continue; } auto tofu_infos = uid.GetTofuInfos(); - SPDLOG_INFO("tofu info size: {}", tofu_infos->size()); + SPDLOG_DEBUG("tofu info size: {}", tofu_infos->size()); if (tofu_infos->empty()) { tofu_tabs_->hide(); } else { @@ -395,7 +395,7 @@ void KeyPairUIDTab::slot_del_uid() { if (ret == QMessageBox::Yes) { for (const auto& uid : *selected_uids) { - SPDLOG_INFO("uid: {}", uid); + SPDLOG_DEBUG("uid: {}", uid); if (!GpgUIDOperator::GetInstance().RevUID(m_key_, uid)) { QMessageBox::critical( nullptr, _("Operation Failed"), @@ -587,8 +587,6 @@ void KeyPairUIDTab::slot_del_sign() { } } void KeyPairUIDTab::slot_refresh_key() { - SPDLOG_INFO("called"); - // refresh the key GpgKey refreshed_key = GpgKeyGetter::GetInstance().GetKey(m_key_.GetId()); std::swap(this->m_key_, refreshed_key); diff --git a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp index 7ab2048e..d09662e1 100644 --- a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp +++ b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp @@ -57,8 +57,8 @@ KeySetExpireDateDialog::KeySetExpireDateDialog(const KeyId& key_id, } void KeySetExpireDateDialog::slot_confirm() { - SPDLOG_INFO("called: {} {}", ui_->dateEdit->date().toString().toStdString(), - ui_->timeEdit->time().toString().toStdString()); + SPDLOG_DEBUG("called: {} {}", ui_->dateEdit->date().toString().toStdString(), + ui_->timeEdit->time().toString().toStdString()); auto datetime = QDateTime(ui_->dateEdit->date(), ui_->timeEdit->time()); std::unique_ptr<boost::posix_time::ptime> expires = nullptr; if (ui_->noExpirationCheckBox->checkState() == Qt::Unchecked) { @@ -70,10 +70,10 @@ void KeySetExpireDateDialog::slot_confirm() { expires = std::make_unique<boost::posix_time::ptime>( boost::posix_time::from_time_t(datetime.toLocalTime().toTime_t())); #endif - SPDLOG_INFO("keyid: {}", m_key_.GetId(), m_subkey_, - to_iso_string(*expires)); + SPDLOG_DEBUG("keyid: {}", m_key_.GetId(), m_subkey_, + to_iso_string(*expires)); } else { - SPDLOG_INFO("keyid: {}", m_key_.GetId(), m_subkey_, "Non Expired"); + SPDLOG_DEBUG("keyid: {}", m_key_.GetId(), m_subkey_, "Non Expired"); } auto err = GpgKeyOpera::GetInstance().SetExpire(m_key_, m_subkey_, expires); @@ -105,7 +105,7 @@ void KeySetExpireDateDialog::init() { bool longer_expiration_date = false; try { longer_expiration_date = settings.lookup("general.longer_expiration_date"); - SPDLOG_INFO("longer_expiration_date: {}", longer_expiration_date); + SPDLOG_DEBUG("longer_expiration_date: {}", longer_expiration_date); } catch (...) { SPDLOG_ERROR("setting operation error: longer_expiration_date"); diff --git a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp index 7d3e3bd6..ca83dbfd 100644 --- a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp +++ b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp @@ -104,13 +104,11 @@ KeyUIDSignDialog::KeyUIDSignDialog(const GpgKey& key, UIDArgsListPtr uid, } void KeyUIDSignDialog::slot_sign_key(bool clicked) { - SPDLOG_INFO("called"); - // Set Signers auto key_ids = m_key_list_->GetChecked(); auto keys = GpgKeyGetter::GetInstance().GetKeys(key_ids); - SPDLOG_INFO("key info got"); + SPDLOG_DEBUG("key info got"); #ifdef GPGFRONTEND_GUI_QT6 auto expires = std::make_unique<boost::posix_time::ptime>(boost::posix_time::from_time_t( @@ -120,9 +118,9 @@ void KeyUIDSignDialog::slot_sign_key(bool clicked) { boost::posix_time::from_time_t(expires_edit_->dateTime().toTime_t())); #endif - SPDLOG_INFO("sign start"); + SPDLOG_DEBUG("sign start"); for (const auto& uid : *m_uids_) { - SPDLOG_INFO("sign uid: {}", uid); + SPDLOG_DEBUG("sign uid: {}", uid); // Sign For mKey if (!GpgKeyManager::GetInstance().SignKey(m_key_, *keys, uid, expires)) { QMessageBox::critical( diff --git a/src/ui/dialog/settings/SettingsDialog.cpp b/src/ui/dialog/settings/SettingsDialog.cpp index 68223637..d484207a 100644 --- a/src/ui/dialog/settings/SettingsDialog.cpp +++ b/src/ui/dialog/settings/SettingsDialog.cpp @@ -108,19 +108,17 @@ void SettingsDialog::slot_set_restart_needed(int mode) { } void SettingsDialog::SlotAccept() { - SPDLOG_INFO("called"); - general_tab_->ApplySettings(); appearance_tab_->ApplySettings(); key_server_tab_->ApplySettings(); network_tab_->ApplySettings(); - SPDLOG_INFO("apply done"); + SPDLOG_DEBUG("apply done"); // write settings to filesystem GlobalSettingStation::GetInstance().SyncSettings(); - SPDLOG_INFO("restart needed: {}", get_restart_needed()); + SPDLOG_DEBUG("restart needed: {}", get_restart_needed()); if (get_restart_needed()) { emit SignalRestartNeeded(get_restart_needed()); } @@ -139,7 +137,7 @@ QHash<QString, QString> SettingsDialog::ListLanguages() { for (int i = 0; i < file_names.size(); ++i) { QString locale = file_names[i]; - SPDLOG_INFO("locale: {}", locale.toStdString()); + SPDLOG_DEBUG("locale: {}", locale.toStdString()); if (locale == "." || locale == "..") continue; // this works in qt 4.8 diff --git a/src/ui/dialog/settings/SettingsGeneral.cpp b/src/ui/dialog/settings/SettingsGeneral.cpp index 34e77278..7e48b4e1 100644 --- a/src/ui/dialog/settings/SettingsGeneral.cpp +++ b/src/ui/dialog/settings/SettingsGeneral.cpp @@ -108,8 +108,8 @@ GeneralTab::GeneralTab(QWidget* parent) this, _("Open Directory"), {}, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - SPDLOG_INFO("key databse path selected: {}", - selected_custom_key_database_path.toStdString()); + SPDLOG_DEBUG("key databse path selected: {}", + selected_custom_key_database_path.toStdString()); if (!selected_custom_key_database_path.isEmpty()) { auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); @@ -141,8 +141,8 @@ GeneralTab::GeneralTab(QWidget* parent) this, _("Open Directory"), {}, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - SPDLOG_INFO("gnupg install path selected: {}", - selected_custom_gnupg_install_path.toStdString()); + SPDLOG_DEBUG("gnupg install path selected: {}", + selected_custom_gnupg_install_path.toStdString()); if (!selected_custom_gnupg_install_path.isEmpty()) { auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); @@ -197,7 +197,7 @@ void GeneralTab::SetSettings() { try { bool longer_expiration_date = settings.lookup("general.longer_expiration_date"); - SPDLOG_INFO("longer_expiration_date: {}", longer_expiration_date); + SPDLOG_DEBUG("longer_expiration_date: {}", longer_expiration_date); if (longer_expiration_date) ui_->longerKeyExpirationDateCheckBox->setCheckState(Qt::Checked); } catch (...) { @@ -208,7 +208,7 @@ void GeneralTab::SetSettings() { try { std::string lang_key = settings.lookup("general.lang"); QString lang_value = lang_.value(lang_key.c_str()); - SPDLOG_INFO("lang settings current: {}", lang_value.toStdString()); + SPDLOG_DEBUG("lang settings current: {}", lang_value.toStdString()); if (!lang_.empty()) { ui_->langSelectBox->setCurrentIndex( ui_->langSelectBox->findText(lang_value)); @@ -222,7 +222,7 @@ void GeneralTab::SetSettings() { try { bool confirm_import_keys = settings.lookup("general.confirm_import_keys"); - SPDLOG_INFO("confirm_import_keys: {}", confirm_import_keys); + SPDLOG_DEBUG("confirm_import_keys: {}", confirm_import_keys); if (confirm_import_keys) ui_->importConfirmationCheckBox->setCheckState(Qt::Checked); } catch (...) { @@ -232,7 +232,7 @@ void GeneralTab::SetSettings() { try { bool non_ascii_when_export = settings.lookup("general.non_ascii_when_export"); - SPDLOG_INFO("non_ascii_when_export: {}", non_ascii_when_export); + SPDLOG_DEBUG("non_ascii_when_export: {}", non_ascii_when_export); if (non_ascii_when_export) ui_->asciiModeCheckBox->setCheckState(Qt::Checked); } catch (...) { @@ -369,8 +369,8 @@ void GeneralTab::slot_update_custom_key_database_path_label(int state) { SPDLOG_ERROR("setting operation error: custom_key_database_path"); } - SPDLOG_INFO("selected_custom_key_database_path from settings: {}", - custom_key_database_path); + SPDLOG_DEBUG("selected_custom_key_database_path from settings: {}", + custom_key_database_path); // set label value if (!custom_key_database_path.empty()) { @@ -403,8 +403,8 @@ void GeneralTab::slot_update_custom_gnupg_install_path_label(int state) { SPDLOG_ERROR("setting operation error: custom_gnupg_install_path"); } - SPDLOG_INFO("custom_gnupg_install_path from settings: {}", - custom_gnupg_install_path); + SPDLOG_DEBUG("custom_gnupg_install_path from settings: {}", + custom_gnupg_install_path); // set label value if (!custom_gnupg_install_path.empty()) { diff --git a/src/ui/dialog/settings/SettingsKeyServer.cpp b/src/ui/dialog/settings/SettingsKeyServer.cpp index 558b3fcc..beb09ee8 100644 --- a/src/ui/dialog/settings/SettingsKeyServer.cpp +++ b/src/ui/dialog/settings/SettingsKeyServer.cpp @@ -74,7 +74,7 @@ KeyserverTab::KeyserverTab(QWidget* parent) connect(ui_->keyServerListTable, &QTableWidget::itemChanged, [=](QTableWidgetItem* item) { - SPDLOG_INFO("item edited: {}", item->column()); + SPDLOG_DEBUG("item edited: {}", item->column()); if (item->column() != 1) return; const auto row_size = ui_->keyServerListTable->rowCount(); // Update Actions diff --git a/src/ui/dialog/settings/SettingsNetwork.cpp b/src/ui/dialog/settings/SettingsNetwork.cpp index d3e4d199..fe3d450e 100644 --- a/src/ui/dialog/settings/SettingsNetwork.cpp +++ b/src/ui/dialog/settings/SettingsNetwork.cpp @@ -151,8 +151,6 @@ void GpgFrontend::UI::NetworkTab::SetSettings() { } void GpgFrontend::UI::NetworkTab::ApplySettings() { - SPDLOG_INFO("called"); - auto &settings = GpgFrontend::GlobalSettingStation::GetInstance().GetUISettings(); @@ -224,8 +222,6 @@ void GpgFrontend::UI::NetworkTab::ApplySettings() { } apply_proxy_settings(); - - SPDLOG_INFO("done"); } void GpgFrontend::UI::NetworkTab::slot_test_proxy_connection_result() { @@ -270,7 +266,7 @@ void GpgFrontend::UI::NetworkTab::slot_test_proxy_connection_result() { waiting_dialog->deleteLater(); }); connect(waiting_dialog, &QProgressDialog::canceled, [=]() { - SPDLOG_INFO("cancel clicked"); + SPDLOG_DEBUG("cancel clicked"); if (thread->isRunning()) thread->terminate(); }); diff --git a/src/ui/main_window/GeneralMainWindow.cpp b/src/ui/main_window/GeneralMainWindow.cpp index 98018c5f..66255a08 100644 --- a/src/ui/main_window/GeneralMainWindow.cpp +++ b/src/ui/main_window/GeneralMainWindow.cpp @@ -47,8 +47,6 @@ void GpgFrontend::UI::GeneralMainWindow::closeEvent(QCloseEvent *event) { void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { try { - SPDLOG_INFO(name_, _("Called")); - SettingsObject general_windows_state(name_ + "_state"); std::string window_state = general_windows_state.Check( @@ -75,7 +73,7 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { size_ = {width, height}; if (this->parent() != nullptr) { - SPDLOG_INFO("parent address: {}", static_cast<void *>(this->parent())); + SPDLOG_DEBUG("parent address: {}", static_cast<void *>(this->parent())); QPoint parent_pos = {0, 0}; QSize parent_size = {0, 0}; @@ -92,10 +90,10 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { parent_size = parent_window->size(); } - SPDLOG_INFO("parent pos x: {} y: {}", parent_pos.x(), parent_pos.y()); + SPDLOG_DEBUG("parent pos x: {} y: {}", parent_pos.x(), parent_pos.y()); - SPDLOG_INFO("parent size width: {} height: {}", parent_size.width(), - parent_size.height()); + SPDLOG_DEBUG("parent size width: {} height: {}", parent_size.width(), + parent_size.height()); if (parent_pos != QPoint{0, 0}) { QPoint parent_center{parent_pos.x() + parent_size.width() / 2, @@ -115,7 +113,7 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { int width = general_settings_state.Check("icon_size").Check("width", 24), height = general_settings_state.Check("icon_size").Check("height", 24); - SPDLOG_INFO("icon size: {} {}", width, height); + SPDLOG_DEBUG("icon size: {} {}", width, height); icon_size_ = {width, height}; font_size_ = general_settings_state.Check("font_size", 10); @@ -135,8 +133,6 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { void GpgFrontend::UI::GeneralMainWindow::slot_save_settings() noexcept { try { - SPDLOG_INFO(name_, _("Called")); - SettingsObject general_windows_state(name_ + "_state"); // window position and size diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index aea84c32..fff3ab63 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -109,7 +109,7 @@ void MainWindow::Init() noexcept { bool show_wizard = true; wizard.lookupValue("show_wizard", show_wizard); - SPDLOG_INFO("wizard show_wizard: {}", show_wizard); + SPDLOG_DEBUG("wizard show_wizard: {}", show_wizard); if (show_wizard) { slot_start_wizard(); @@ -131,7 +131,7 @@ void MainWindow::Init() noexcept { // before application exit connect(qApp, &QCoreApplication::aboutToQuit, this, []() { - SPDLOG_INFO("about to quit process started"); + SPDLOG_DEBUG("about to quit process started"); auto &settings = GlobalSettingStation::GetInstance().GetUISettings(); try { @@ -141,7 +141,7 @@ void MainWindow::Init() noexcept { if (clear_gpg_password_cache) { if (GpgFrontend::GpgAdvancedOperator::GetInstance() .ClearGpgPasswordCache()) { - SPDLOG_INFO("clear gpg password cache done"); + SPDLOG_DEBUG("clear gpg password cache done"); } else { SPDLOG_ERROR("clear gpg password cache error"); } @@ -162,10 +162,8 @@ void MainWindow::Init() noexcept { } void MainWindow::restore_settings() { - SPDLOG_INFO("called"); - try { - SPDLOG_INFO("restore settings key_server"); + SPDLOG_DEBUG("restore settings key_server"); SettingsObject key_server_json("key_server"); if (!key_server_json.contains("server_list") || @@ -201,7 +199,7 @@ void MainWindow::restore_settings() { import_button_->setToolButtonStyle(icon_style_); try { - SPDLOG_INFO("restore settings default_key_checked"); + SPDLOG_DEBUG("restore settings default_key_checked"); // Checked Keys SettingsObject default_key_checked("default_key_checked"); @@ -209,7 +207,7 @@ void MainWindow::restore_settings() { auto key_ids_ptr = std::make_unique<KeyIdArgsList>(); for (auto &it : default_key_checked) { std::string key_id = it; - SPDLOG_INFO("get checked key id: {}", key_id); + SPDLOG_DEBUG("get checked key id: {}", key_id); key_ids_ptr->push_back(key_id); } m_key_list_->SetChecked(std::move(key_ids_ptr)); @@ -231,7 +229,7 @@ void MainWindow::restore_settings() { } GlobalSettingStation::GetInstance().SyncSettings(); - SPDLOG_INFO("settings restored"); + SPDLOG_DEBUG("settings restored"); } void MainWindow::save_settings() { diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index 39326ad0..598ba33c 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -67,7 +67,7 @@ bool path_pre_check(QWidget* parent, const QString& path) { */ bool process_tarball_into_directory(QWidget* parent, std::filesystem::path& path) { - SPDLOG_INFO("converting directory into tarball: {}", path.u8string()); + SPDLOG_DEBUG("converting directory into tarball: {}", path.u8string()); auto selected_dir_path = std::filesystem::path(path); if (selected_dir_path.extension() != ".tar") { @@ -81,8 +81,8 @@ bool process_tarball_into_directory(QWidget* parent, auto target_path = selected_dir_path; target_path.replace_extension(".tar"); - SPDLOG_INFO("base path: {} target archive path: {]", base_path.u8string(), - target_path.u8string()); + SPDLOG_DEBUG("base path: {} target archive path: {]", base_path.u8string(), + target_path.u8string()); bool if_error = false; process_operation(parent, _("Extracting Tarball"), @@ -125,9 +125,9 @@ bool process_directory_into_tarball(QWidget* parent, QString& path) { auto target_path = selected_dir_path; selected_dir_path.replace_extension(""); - SPDLOG_INFO("base path: {} target archive path: {} selected_dir_path: {}", - base_path.u8string(), target_path.u8string(), - selected_dir_path.u8string()); + SPDLOG_DEBUG("base path: {} target archive path: {} selected_dir_path: {}", + base_path.u8string(), target_path.u8string(), + selected_dir_path.u8string()); bool if_error = false; process_operation(parent, _("Making Tarball"), @@ -489,8 +489,8 @@ void MainWindow::SlotFileVerify() { data_file_path = sign_file_path.parent_path() / sign_file_path.stem(); } - SPDLOG_INFO("sign_file_path: {} {}", sign_file_path.u8string(), - sign_file_path.extension().u8string()); + SPDLOG_DEBUG("sign_file_path: {} {}", sign_file_path.u8string(), + sign_file_path.extension().u8string()); if (in_path.extension() != ".gpg") { bool ok; @@ -513,8 +513,8 @@ void MainWindow::SlotFileVerify() { return; } - SPDLOG_INFO("data path: {}", data_file_path.u8string()); - SPDLOG_INFO("sign path: {}", sign_file_path.u8string()); + SPDLOG_DEBUG("data path: {}", data_file_path.u8string()); + SPDLOG_DEBUG("sign path: {}", sign_file_path.u8string()); GpgVerifyResult result = nullptr; gpgme_error_t error; @@ -699,7 +699,7 @@ void MainWindow::SlotFileDecryptVerify() { } else { out_path += ".out"; } - SPDLOG_INFO("out path: {}", out_path.u8string()); + SPDLOG_DEBUG("out path: {}", out_path.u8string()); if (QFile::exists(out_path.u8string().c_str())) { auto ret = diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index 870c7c5c..6f702e34 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -342,7 +342,7 @@ void MainWindow::slot_verify() { auto buffer = data_object->PopObject<std::string>(); - SPDLOG_INFO("verify buffer size: {}", buffer.size()); + SPDLOG_DEBUG("verify buffer size: {}", buffer.size()); try { GpgVerifyResult verify_result = nullptr; @@ -431,11 +431,11 @@ void MainWindow::slot_encrypt_sign() { auto signer_keys = GpgKeyGetter::GetInstance().GetKeys(signer_key_ids); for (const auto& key : *keys) { - SPDLOG_INFO("keys {}", key.GetEmail()); + SPDLOG_DEBUG("keys {}", key.GetEmail()); } for (const auto& signer : *signer_keys) { - SPDLOG_INFO("signers {}", signer.GetEmail()); + SPDLOG_DEBUG("signers {}", signer.GetEmail()); } // data to transfer into task @@ -660,10 +660,8 @@ void MainWindow::upload_key_to_server() { void MainWindow::SlotOpenFile(QString& path) { edit_->SlotOpenFile(path); } void MainWindow::slot_version_upgrade(const SoftwareVersion& version) { - SPDLOG_INFO("called"); - if (!version.InfoValid()) { - SPDLOG_INFO("invalid version info"); + SPDLOG_ERROR("invalid version info"); return; } diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp index 722be60a..8839df4b 100644 --- a/src/ui/main_window/MainWindowSlotUI.cpp +++ b/src/ui/main_window/MainWindowSlotUI.cpp @@ -104,13 +104,11 @@ void MainWindow::slot_open_settings_dialog() { auto dialog = new SettingsDialog(this); connect(dialog, &SettingsDialog::finished, this, [&]() -> void { - SPDLOG_INFO("setting dialog finished"); - SettingsObject general_settings_state("general_settings_state"); int width = general_settings_state.Check("icon_size").Check("width", 24), height = general_settings_state.Check("icon_size").Check("height", 24); - SPDLOG_INFO("icon_size: {} {}", width, height); + SPDLOG_DEBUG("icon_size: {} {}", width, height); general_settings_state.Check("info_font_size", 10); @@ -184,7 +182,7 @@ void MainWindow::slot_cut_pgp_header() { } void MainWindow::SlotSetRestartNeeded(int mode) { - SPDLOG_INFO("restart mode: {}", mode); + SPDLOG_DEBUG("restart mode: {}", mode); this->restart_needed_ = mode; } @@ -192,7 +190,7 @@ int MainWindow::get_restart_needed() const { return this->restart_needed_; } void MainWindow::SetCryptoMenuStatus( MainWindow::CryptoMenu::OperationType type) { - SPDLOG_INFO("type: {}", type); + SPDLOG_DEBUG("type: {}", type); // refresh status to disable all verify_act_->setDisabled(true); diff --git a/src/ui/struct/SettingsObject.cpp b/src/ui/struct/SettingsObject.cpp index f2fb4820..d5230089 100644 --- a/src/ui/struct/SettingsObject.cpp +++ b/src/ui/struct/SettingsObject.cpp @@ -32,7 +32,7 @@ nlohmann::json& GpgFrontend::UI::SettingsObject::Check( const std::string& key, const nlohmann::json& default_value) { // check if the self null if (this->nlohmann::json::is_null()) { - SPDLOG_INFO("settings object is null, creating new one"); + SPDLOG_DEBUG("settings object is null, creating new one"); this->nlohmann::json::operator=(nlohmann::json::object()); } @@ -41,7 +41,7 @@ nlohmann::json& GpgFrontend::UI::SettingsObject::Check( this->nlohmann::json::at(key).is_null() || this->nlohmann::json::at(key).type_name() != default_value.type_name()) { - SPDLOG_INFO("added missing key: {}", key); + SPDLOG_DEBUG("added missing key: {}", key); if (default_value.is_null()) { SPDLOG_WARN("default value is null, using empty object"); this->nlohmann::json::operator[](key) = nlohmann::json::object(); @@ -60,14 +60,14 @@ GpgFrontend::UI::SettingsObject GpgFrontend::UI::SettingsObject::Check( const std::string& key) { // check if the self null if (this->nlohmann::json::is_null()) { - SPDLOG_INFO("settings object is null, creating new one"); + SPDLOG_DEBUG("settings object is null, creating new one"); this->nlohmann::json::operator=(nlohmann::json::object()); } if (!nlohmann::json::contains(key) || this->nlohmann::json::at(key).is_null() || this->nlohmann::json::at(key).type() != nlohmann::json::value_t::object) { - SPDLOG_INFO("added missing key: {}", key); + SPDLOG_DEBUG("added missing key: {}", key); this->nlohmann::json::operator[](key) = nlohmann::json::object(); } return SettingsObject{nlohmann::json::operator[](key), false}; @@ -76,16 +76,16 @@ GpgFrontend::UI::SettingsObject GpgFrontend::UI::SettingsObject::Check( GpgFrontend::UI::SettingsObject::SettingsObject(std::string settings_name) : settings_name_(std::move(settings_name)) { try { - SPDLOG_INFO("loading settings from: {}", this->settings_name_); + SPDLOG_DEBUG("loading settings from: {}", this->settings_name_); auto _json_optional = GpgFrontend::DataObjectOperator::GetInstance().GetDataObject( settings_name_); if (_json_optional.has_value()) { - SPDLOG_INFO("settings object: {} loaded.", settings_name_); + SPDLOG_DEBUG("settings object: {} loaded.", settings_name_); nlohmann::json::operator=(_json_optional.value()); } else { - SPDLOG_INFO("settings object: {} not found.", settings_name_); + SPDLOG_DEBUG("settings object: {} not found.", settings_name_); nlohmann::json::operator=({}); } diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index 71c7c0ba..17bb0356 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -44,20 +44,20 @@ void GpgFrontend::UI::ListedKeyServerTestTask::run() { size_t index = 0; for (const auto& url : urls_) { auto key_url = QUrl{url}; - SPDLOG_INFO("key server request: {}", key_url.host().toStdString()); + SPDLOG_DEBUG("key server request: {}", key_url.host().toStdString()); auto* network_reply = network_manager_->get(QNetworkRequest{key_url}); auto* timer = new QTimer(this); connect(network_reply, &QNetworkReply::finished, this, [this, index, network_reply]() { - SPDLOG_INFO("key server domain reply: {}", - urls_[index].toStdString()); + SPDLOG_DEBUG("key server domain reply: {}", + urls_[index].toStdString()); this->slot_process_network_reply(index, network_reply); }); connect(timer, &QTimer::timeout, this, [this, index, network_reply]() { - SPDLOG_INFO("timeout for key server: {}", urls_[index].toStdString()); + SPDLOG_DEBUG("timeout for key server: {}", urls_[index].toStdString()); if (network_reply->isRunning()) { network_reply->abort(); this->slot_process_network_reply(index, network_reply); diff --git a/src/ui/thread/ProxyConnectionTestThread.cpp b/src/ui/thread/ProxyConnectionTestThread.cpp index 068afedf..8b113453 100644 --- a/src/ui/thread/ProxyConnectionTestThread.cpp +++ b/src/ui/thread/ProxyConnectionTestThread.cpp @@ -31,13 +31,13 @@ void GpgFrontend::UI::ProxyConnectionTestThread::run() { auto proxies_list = QNetworkProxyFactory::systemProxyForQuery(npq); if (proxies_list.isEmpty()) { - SPDLOG_INFO("no proxy applied"); + SPDLOG_DEBUG("no proxy applied"); } else { - SPDLOG_INFO("proxies list hostname: {}", - proxies_list.front().hostName().toStdString()); + SPDLOG_DEBUG("proxies list hostname: {}", + proxies_list.front().hostName().toStdString()); } - SPDLOG_INFO("proxies list size: {}", proxies_list.size()); + SPDLOG_DEBUG("proxies list size: {}", proxies_list.size()); auto manager = std::make_unique<QNetworkAccessManager>(nullptr); QNetworkRequest url_request; diff --git a/src/ui/thread/VersionCheckTask.cpp b/src/ui/thread/VersionCheckTask.cpp index ebb970a8..45fe8c80 100644 --- a/src/ui/thread/VersionCheckTask.cpp +++ b/src/ui/thread/VersionCheckTask.cpp @@ -49,7 +49,7 @@ void VersionCheckTask::Run() { try { using namespace nlohmann; - SPDLOG_INFO("current version: {}", current_version_); + SPDLOG_DEBUG("current version: {}", current_version_); std::string latest_version_url = "https://api.github.com/repos/saturneric/gpgfrontend/releases/latest"; @@ -90,7 +90,7 @@ void VersionCheckTask::slot_parse_latest_version_info() { auto version_match = re.match(latest_version.c_str()); if (version_match.hasMatch()) { latest_version = version_match.captured(0).toStdString(); - SPDLOG_INFO("latest version matched: {}", latest_version); + SPDLOG_DEBUG("latest version matched: {}", latest_version); } else { latest_version = current_version_; SPDLOG_WARN("latest version unknown"); @@ -143,7 +143,7 @@ void VersionCheckTask::slot_parse_current_version_info() { } else { version_.current_version_found = true; current_reply_bytes_ = current_reply_->readAll(); - SPDLOG_INFO("current version: {}", current_reply_bytes_.size()); + SPDLOG_DEBUG("current version: {}", current_reply_bytes_.size()); auto current_reply_json = nlohmann::json::parse(current_reply_bytes_.toStdString()); bool current_prerelease = current_reply_json["prerelease"], diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp index 98b46467..144de3d8 100644 --- a/src/ui/widgets/FilePage.cpp +++ b/src/ui/widgets/FilePage.cpp @@ -108,7 +108,7 @@ void FilePage::slot_file_tree_view_item_clicked(const QModelIndex& index) { #endif m_path_ = selected_path_; - SPDLOG_INFO("selected path: {}", selected_path_.u8string()); + SPDLOG_DEBUG("selected path: {}", selected_path_.u8string()); selected_path_ = std::filesystem::path(selected_path_); MainWindow::CryptoMenu::OperationType operation_type = @@ -164,10 +164,10 @@ void FilePage::slot_up_level() { std::filesystem::path path_obj(str_path); m_path_ = path_obj; - SPDLOG_INFO("get path: {}", m_path_.u8string()); + SPDLOG_DEBUG("get path: {}", m_path_.u8string()); if (m_path_.has_parent_path() && !m_path_.parent_path().empty()) { m_path_ = m_path_.parent_path(); - SPDLOG_INFO("parent path: {}", m_path_.u8string()); + SPDLOG_DEBUG("parent path: {}", m_path_.u8string()); ui_->pathEdit->setText(m_path_.u8string().c_str()); this->SlotGoPath(); } @@ -204,7 +204,7 @@ void FilePage::SlotGoPath() { m_path_ = std::filesystem::path(fileInfo.filePath().toStdString()); #endif - SPDLOG_INFO("set path: {}", m_path_.u8string()); + SPDLOG_DEBUG("set path: {}", m_path_.u8string()); ui_->fileTreeView->setRootIndex(dir_model_->index(fileInfo.filePath())); dir_model_->setRootPath(fileInfo.filePath()); for (int i = 1; i < dir_model_->columnCount(); ++i) { @@ -267,7 +267,7 @@ void FilePage::create_popup_menu() { auto showHiddenAct = new QAction(_("Show Hidden File"), this); showHiddenAct->setCheckable(true); connect(showHiddenAct, &QAction::triggered, this, [&](bool checked) { - SPDLOG_INFO("set hidden: {}", checked); + SPDLOG_DEBUG("set hidden: {}", checked); if (checked) dir_model_->setFilter(dir_model_->filter() | QDir::Hidden); else @@ -279,7 +279,7 @@ void FilePage::create_popup_menu() { auto showSystemAct = new QAction(_("Show System File"), this); showSystemAct->setCheckable(true); connect(showSystemAct, &QAction::triggered, this, [&](bool checked) { - SPDLOG_INFO("set hidden: {}", checked); + SPDLOG_DEBUG("set hidden: {}", checked); if (checked) dir_model_->setFilter(dir_model_->filter() | QDir::System); else @@ -291,7 +291,7 @@ void FilePage::create_popup_menu() { void FilePage::onCustomContextMenu(const QPoint& point) { QModelIndex index = ui_->fileTreeView->indexAt(point); - SPDLOG_INFO("right click: {}", selected_path_.u8string()); + SPDLOG_DEBUG("right click: {}", selected_path_.u8string()); #ifdef WINDOWS auto index_dir_str = @@ -328,7 +328,7 @@ void FilePage::slot_open_item() { if (info.isDir()) { if (info.isReadable() && info.isExecutable()) { const auto file_path = info.filePath().toUtf8().toStdString(); - SPDLOG_INFO("set path: {}", file_path); + SPDLOG_DEBUG("set path: {}", file_path); ui_->pathEdit->setText(info.filePath().toUtf8()); SlotGoPath(); } else { @@ -340,7 +340,7 @@ void FilePage::slot_open_item() { // handle normal text or binary file auto main_window = qobject_cast<MainWindow*>(first_parent_); auto qt_open_path = QString::fromStdString(selected_path_.u8string()); - SPDLOG_INFO("open item: {}", qt_open_path.toStdString()); + SPDLOG_DEBUG("open item: {}", qt_open_path.toStdString()); if (main_window != nullptr) main_window->SlotOpenFile(qt_open_path); } else { QMessageBox::critical(this, _("Error"), @@ -365,7 +365,7 @@ void FilePage::slot_rename_item() { #else new_name_path /= text.toStdString(); #endif - SPDLOG_INFO("new name path: {}", new_name_path.u8string()); + SPDLOG_DEBUG("new name path: {}", new_name_path.u8string()); std::filesystem::rename(old_name_path, new_name_path); // refresh this->SlotGoPath(); @@ -387,7 +387,7 @@ void FilePage::slot_delete_item() { if (ret == QMessageBox::Cancel) return; - SPDLOG_INFO("delete item: {}", data.toString().toStdString()); + SPDLOG_DEBUG("delete item: {}", data.toString().toStdString()); if (!dir_model_->remove(index)) { QMessageBox::critical(this, _("Error"), @@ -441,7 +441,7 @@ void FilePage::slot_create_empty_file() { } void FilePage::keyPressEvent(QKeyEvent* event) { - SPDLOG_INFO("key press: {}", event->key()); + SPDLOG_DEBUG("key press: {}", event->key()); if (ui_->pathEdit->hasFocus() && (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)) { SlotGoPath(); diff --git a/src/ui/widgets/InfoBoardWidget.cpp b/src/ui/widgets/InfoBoardWidget.cpp index fceefe2a..98b07089 100644 --- a/src/ui/widgets/InfoBoardWidget.cpp +++ b/src/ui/widgets/InfoBoardWidget.cpp @@ -113,7 +113,7 @@ void InfoBoardWidget::AssociateTabWidget(QTabWidget* tab) { void InfoBoardWidget::AddOptionalAction(const QString& name, const std::function<void()>& action) { - SPDLOG_INFO("add option: {}", name.toStdString()); + SPDLOG_DEBUG("add option: {}", name.toStdString()); auto actionButton = new QPushButton(name); auto layout = new QHBoxLayout(); layout->setContentsMargins(5, 0, 5, 0); @@ -143,8 +143,6 @@ void InfoBoardWidget::SlotReset() { */ void InfoBoardWidget::delete_widgets_in_layout(QLayout* layout, int start_index) { - SPDLOG_INFO("called"); - QLayoutItem* item; while ((item = layout->layout()->takeAt(start_index)) != nullptr) { layout->removeItem(item); @@ -164,7 +162,7 @@ void InfoBoardWidget::slot_copy() { void InfoBoardWidget::slot_save() { auto file_path = QFileDialog::getSaveFileName( this, _("Save Information Board's Content"), {}, tr("Text (*.txt)")); - SPDLOG_INFO("file path: {{}", file_path.toStdString()); + SPDLOG_DEBUG("file path: {}", file_path.toStdString()); if (file_path.isEmpty()) return; QFile file(file_path); diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index 246e3d5a..e426ed48 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -100,7 +100,7 @@ void KeyList::AddListGroupTab( const QString& name, KeyListRow::KeyType selectType, KeyListColumn::InfoType infoType, const std::function<bool(const GpgKey&)>& filter) { - SPDLOG_INFO("called: {}", name.toStdString()); + SPDLOG_DEBUG("add tab: {}", name.toStdString()); auto key_list = new QTableWidget(this); if (m_key_list_ == nullptr) { @@ -158,7 +158,7 @@ void KeyList::AddListGroupTab( } void KeyList::SlotRefresh() { - SPDLOG_INFO("called address: {}", static_cast<void*>(this)); + SPDLOG_DEBUG("refresh, address: {}", static_cast<void*>(this)); ui_->refreshKeyListButton->setDisabled(true); ui_->syncButton->setDisabled(true); @@ -317,7 +317,7 @@ void KeyList::dropEvent(QDropEvent* event) { bool confirm_import_keys = true; try { confirm_import_keys = settings.lookup("general.confirm_import_keys"); - SPDLOG_INFO("confirm_import_keys: {}", confirm_import_keys); + SPDLOG_DEBUG("confirm_import_keys: {}", confirm_import_keys); if (confirm_import_keys) checkBox->setCheckState(Qt::Checked); } catch (...) { SPDLOG_ERROR("setting operation error: confirm_import_keys"); @@ -358,7 +358,7 @@ void KeyList::dropEvent(QDropEvent* event) { QFile file; file.setFileName(tmp.toLocalFile()); if (!file.open(QIODevice::ReadOnly)) { - SPDLOG_INFO("couldn't open file: {}", tmp.toString().toStdString()); + SPDLOG_ERROR("couldn't open file: {}", tmp.toString().toStdString()); } QByteArray inBuffer = file.readAll(); this->import_keys(inBuffer); @@ -418,7 +418,7 @@ std::string KeyList::GetSelectedKey() { } void KeyList::slot_refresh_ui() { - SPDLOG_INFO("called: {}", static_cast<void*>(buffered_keys_list_.get())); + SPDLOG_DEBUG("refresh: {}", static_cast<void*>(buffered_keys_list_.get())); if (buffered_keys_list_ != nullptr) { std::lock_guard<std::mutex> guard(buffered_key_list_mutex_); for (auto& key_table : m_key_tables_) { @@ -450,8 +450,8 @@ void KeyList::slot_sync_with_key_server() { CommonUtils::SlotImportKeyFromKeyServer( key_ids, [=](const std::string& key_id, const std::string& status, size_t current_index, size_t all_index) { - SPDLOG_INFO("called: {} {} {} {}", key_id, status, current_index, - all_index); + SPDLOG_DEBUG("import key: {} {} {} {}", key_id, status, current_index, + all_index); auto key = GpgKeyGetter::GetInstance().GetKey(key_id); boost::format status_str = boost::format(_("Sync [%1%/%2%] %3% %4%")) % @@ -502,7 +502,7 @@ KeyIdArgsListPtr& KeyTable::GetChecked() { auto& ret = checked_key_ids_; for (int i = 0; i < buffered_keys_.size(); i++) { auto key_id = buffered_keys_[i].GetId(); - SPDLOG_INFO("i: {} key_id: {}", i, key_id); + SPDLOG_DEBUG("i: {} key_id: {}", i, key_id); if (key_list_->item(i, 0)->checkState() == Qt::Checked && std::find(ret->begin(), ret->end(), key_id) == ret->end()) { ret->push_back(key_id); @@ -512,7 +512,6 @@ KeyIdArgsListPtr& KeyTable::GetChecked() { } void KeyTable::SetChecked(KeyIdArgsListPtr key_ids) { - SPDLOG_INFO("called"); checked_key_ids_ = std::move(key_ids); } @@ -534,14 +533,14 @@ void KeyTable::Refresh(KeyLinkListPtr m_keys) { int row_count = 0; while (it != keys->end()) { - SPDLOG_INFO("filtering key id: {}", it->GetId()); + SPDLOG_DEBUG("filtering key id: {}", it->GetId()); if (filter_ != nullptr) { if (!filter_(*it)) { it = keys->erase(it); continue; } } - SPDLOG_INFO("adding key id: {}", it->GetId()); + SPDLOG_DEBUG("adding key id: {}", it->GetId()); if (select_type_ == KeyListRow::ONLY_SECRET_KEY && !it->IsPrivateKey()) { it = keys->erase(it); continue; @@ -624,8 +623,8 @@ void KeyTable::Refresh(KeyLinkListPtr m_keys) { tmp3->setFont(strike); } - SPDLOG_INFO("key id: {} added into key_list_: {}", it->GetId(), - static_cast<void*>(this)); + SPDLOG_DEBUG("key id: {} added into key_list_: {}", it->GetId(), + static_cast<void*>(this)); // move to buffered keys buffered_keys_.emplace_back(std::move(*it)); diff --git a/src/ui/widgets/PlainTextEditorPage.cpp b/src/ui/widgets/PlainTextEditorPage.cpp index fc6a25bf..c97537c3 100644 --- a/src/ui/widgets/PlainTextEditorPage.cpp +++ b/src/ui/widgets/PlainTextEditorPage.cpp @@ -160,8 +160,6 @@ void PlainTextEditorPage::slot_format_gpg_header() { } void PlainTextEditorPage::ReadFile() { - SPDLOG_INFO("called"); - read_done_ = false; read_bytes_ = 0; ui_->textPage->setEnabled(false); @@ -185,7 +183,7 @@ void PlainTextEditorPage::ReadFile() { &FileReadTask::SignalFileBytesReadNext, Qt::QueuedConnection); connect(read_task, &FileReadTask::SignalTaskFinished, this, - []() { SPDLOG_INFO("read thread closed"); }); + []() { SPDLOG_DEBUG("read thread closed"); }); connect(this, &PlainTextEditorPage::close, read_task, &FileReadTask::SignalTaskFinished); connect(read_task, &FileReadTask::SignalFileBytesReadEnd, this, [=]() { @@ -212,7 +210,7 @@ std::string binary_to_string(const std::string &source) { void PlainTextEditorPage::slot_insert_text(QByteArray bytes_data) { std::string data = bytes_data.toStdString(); - SPDLOG_INFO("data size: {}", data.size()); + SPDLOG_DEBUG("data size: {}", data.size()); read_bytes_ += data.size(); // If binary format is detected, the entire file is converted to binary // format for display. @@ -260,7 +258,6 @@ void PlainTextEditorPage::slot_insert_text(QByteArray bytes_data) { this->ui_->characterLabel->setText(str.str().c_str()); } QTimer::singleShot(25, this, &PlainTextEditorPage::SignalUIBytesDisplayed); - SPDLOG_INFO("end"); } void PlainTextEditorPage::detect_encoding(const std::string &data) { diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index 344f422e..4947e179 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -88,7 +88,7 @@ void TextEdit::SlotNewFileTab() const { void TextEdit::SlotOpenFile(const QString& path) { QFile file(path); - SPDLOG_INFO("path: {}", path.toStdString()); + SPDLOG_DEBUG("path: {}", path.toStdString()); auto result = file.open(QIODevice::ReadOnly | QIODevice::Text); if (result) { auto* page = new PlainTextEditorPage(path); @@ -506,7 +506,7 @@ QHash<int, QString> TextEdit::UnsavedDocuments() const { if (ep != nullptr && ep->ReadDone() && ep->GetTextPage()->document()->isModified()) { QString doc_name = tab_widget_->tabText(i); - SPDLOG_INFO("unsaved: {}", doc_name.toStdString()); + SPDLOG_DEBUG("unsaved: {}", doc_name.toStdString()); // remove * before name of modified doc doc_name.remove(0, 2); |