aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/KeyPackageOperator.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2023-02-03 13:43:55 +0000
committerSaturneric <[email protected]>2023-02-03 13:43:55 +0000
commit11d32517c2f6f538209c893c6b0b24572fba1a36 (patch)
tree0dac14bcad75d9c7c5b5723dc23e6409721966b4 /src/core/function/KeyPackageOperator.cpp
parentfeat: change logging framework to spdlog (diff)
downloadGpgFrontend-11d32517c2f6f538209c893c6b0b24572fba1a36.tar.gz
GpgFrontend-11d32517c2f6f538209c893c6b0b24572fba1a36.zip
feat: change the log style in source files
Diffstat (limited to 'src/core/function/KeyPackageOperator.cpp')
-rw-r--r--src/core/function/KeyPackageOperator.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/function/KeyPackageOperator.cpp b/src/core/function/KeyPackageOperator.cpp
index 3779c64b..2dc786cf 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);
- LOG(INFO) << "Generated passphrase: " << phrase.size() << " bytes";
+ SPDLOG_INFO("generated passphrase: {} bytes", phrase.size());
return FileOperator::WriteFileStd(phrase_path, phrase);
}
@@ -47,12 +47,12 @@ bool KeyPackageOperator::GenerateKeyPackage(
const std::filesystem::path& key_package_path,
const std::string& key_package_name, KeyIdArgsListPtr& key_ids,
std::string& phrase, bool secret) {
- LOG(INFO) << "Generating key package: " << key_package_name;
+ SPDLOG_INFO("generating key package: {}", key_package_name);
ByteArrayPtr key_export_data = nullptr;
if (!GpgKeyImportExporter::GetInstance().ExportKeys(key_ids, key_export_data,
secret)) {
- LOG(ERROR) << "Failed to export keys";
+ SPDLOG_ERROR("failed to export keys");
return false;
}
@@ -64,7 +64,7 @@ bool KeyPackageOperator::GenerateKeyPackage(
QAESEncryption::Padding::ISO);
auto encoded = encryption.encode(data, hash_key);
- LOG(INFO) << "Writing key package: " << key_package_name;
+ SPDLOG_INFO("writing key package: {}", key_package_name);
return FileOperator::WriteFileStd(key_package_path, encoded.toStdString());
}
@@ -72,21 +72,21 @@ bool KeyPackageOperator::ImportKeyPackage(
const std::filesystem::path& key_package_path,
const std::filesystem::path& phrase_path,
GpgFrontend::GpgImportInformation& import_info) {
- LOG(INFO) << "Importing key package: " << key_package_path.u8string();
+ SPDLOG_INFO("importing key package: {]", key_package_path.u8string());
std::string encrypted_data;
FileOperator::ReadFileStd(key_package_path, encrypted_data);
if (encrypted_data.empty()) {
- LOG(ERROR) << "Failed to read key package: " << key_package_path.u8string();
+ SPDLOG_ERROR("failed to read key package: {}", key_package_path.u8string());
return false;
};
std::string passphrase;
FileOperator::ReadFileStd(phrase_path, passphrase);
- LOG(INFO) << "Passphrase: " << passphrase.size() << " bytes";
+ SPDLOG_INFO("passphrase: {} bytes", passphrase.size());
if (passphrase.size() != 256) {
- LOG(ERROR) << "Failed to read passphrase: " << phrase_path.u8string();
+ 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);
- LOG(INFO) << "key data" << key_data.size();
+ SPDLOG_INFO("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;