aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/thread/FileReadTask.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/thread/FileReadTask.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/thread/FileReadTask.cpp')
-rw-r--r--src/core/thread/FileReadTask.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/thread/FileReadTask.cpp b/src/core/thread/FileReadTask.cpp
index 3a235390..1ac23a89 100644
--- a/src/core/thread/FileReadTask.cpp
+++ b/src/core/thread/FileReadTask.cpp
@@ -26,8 +26,6 @@
#include "core/thread/FileReadTask.h"
-#include <utility>
-
namespace GpgFrontend::UI {
FileReadTask::FileReadTask(std::string path) {
@@ -48,18 +46,18 @@ void FileReadTask::Run() {
SetFinishAfterRun(false);
if (is_regular_file(read_file_path_)) {
- LOG(INFO) << "read open file" << read_file_path_;
+ SPDLOG_INFO("read open file: {}", read_file_path_.u8string());
target_file_.setFileName(
QString::fromStdString(read_file_path_.u8string()));
target_file_.open(QIODevice::ReadOnly);
if (!(target_file_.isOpen() && target_file_.isReadable())) {
- LOG(ERROR) << "file not open or not readable";
+ SPDLOG_ERROR("file not open or not readable");
if (target_file_.isOpen()) target_file_.close();
return;
}
- LOG(INFO) << "started reading" << read_file_path_;
+ SPDLOG_INFO("started reading: {}", read_file_path_.u8string());
read_bytes();
} else {
emit SignalFileBytesReadEnd();
@@ -70,10 +68,10 @@ void FileReadTask::read_bytes() {
QByteArray read_buffer;
if (!target_file_.atEnd() &&
(read_buffer = target_file_.read(buffer_size_)).size() > 0) {
- LOG(INFO) << "read bytes" << read_buffer.size();
+ SPDLOG_INFO("read bytes: {}", read_buffer.size());
emit SignalFileBytesRead(std::move(read_buffer));
} else {
- LOG(INFO) << "read bytes end";
+ SPDLOG_INFO("read bytes end");
emit SignalFileBytesReadEnd();
// finish task
emit SignalTaskFinished();
@@ -81,7 +79,7 @@ void FileReadTask::read_bytes() {
}
FileReadTask::~FileReadTask() {
- LOG(INFO) << "close file" << read_file_path_;
+ SPDLOG_INFO("close file: {}", read_file_path_.u8string());
if (target_file_.isOpen()) target_file_.close();
}