fix logger

This commit is contained in:
Hepatica
2024-08-10 06:37:28 +02:00
parent 500e394507
commit 4e94641571

View File

@@ -48,8 +48,7 @@ public:
// Output to log file
if (logFile.is_open()) {
logFile << logEntry.str();
logFile
.flush(); // Ensure immediate write to file
logFile.flush(); // Ensure immediate write to file
}
}
@@ -78,7 +77,7 @@ private:
int main()
{
Logger logger("logfile.txt"); //
Logger logger("logfile.txt");
std::cout << "SpCloud start\n";
@@ -86,23 +85,21 @@ int main()
logger.log(INFO, "Program started.");
svr.Get("/ping", [](const httplib::Request& req, httplib::Response& res)
svr.Get("/ping", [&](const httplib::Request& req, httplib::Response& res)
{
std::cout << "Ping-\n";
logger.log(INFO, "App was pinged.");
res.set_content("Pong", "text/plain");
httplib::Headers test = req.headers;
});
// Предполагается, что эти классы определены где-то еще
AuthorizationService authorization_service;
FileProcessingService file_processing;
//PublishController publish_controller(svr, authorization_service, file_processing);
PublishController publish_controller(svr, authorization_service, file_processing);
std::cout << "Server is running at http://localhost:8080" << '\n';