Change scope of file processing and adjust di in publish contoller

This commit is contained in:
Hepatica
2024-08-11 02:22:09 +02:00
parent 1f3086c96c
commit f2f8169c61
3 changed files with 16 additions and 10 deletions

View File

@@ -6,15 +6,18 @@
#include <thread>
#include <sys/stat.h>
#include "CommandService.cpp"
#include "Logger.cpp"
//#include <Poco/Mutex.h>
//#include <Poco/Path.h>
//#include <Poco/FileStr*/eam.h >
class FileProcessingService
{
public:
FileProcessingService(/*&Logger logger*/)
FileProcessingService(Logger& logger) : logger_(logger)
{
}
bool save_file(const std::string& filename, const std::string& content) {
@@ -25,8 +28,9 @@ public:
if (!ofs) return false;
ofs << content;
logger_.log(INFO, "Start saving file");
ofs << content;
return ofs.good();
}
@@ -136,4 +140,5 @@ public:
/*private:
std::mutex file_mutex; */// Мьютекс для синхронизации доступа к файлу
Logger& logger_;
};