mirror of
https://github.com/yawaflua/SpCloudCore.git
synced 2025-12-09 20:19:35 +02:00
fix logger
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user