mirror of
https://github.com/yawaflua/SpCloudCore.git
synced 2026-02-04 02:44:18 +02:00
fix logger
This commit is contained in:
@@ -48,8 +48,7 @@ public:
|
|||||||
// Output to log file
|
// Output to log file
|
||||||
if (logFile.is_open()) {
|
if (logFile.is_open()) {
|
||||||
logFile << logEntry.str();
|
logFile << logEntry.str();
|
||||||
logFile
|
logFile.flush(); // Ensure immediate write to file
|
||||||
.flush(); // Ensure immediate write to file
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +77,7 @@ private:
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Logger logger("logfile.txt"); //
|
Logger logger("logfile.txt");
|
||||||
|
|
||||||
std::cout << "SpCloud start\n";
|
std::cout << "SpCloud start\n";
|
||||||
|
|
||||||
@@ -86,23 +85,21 @@ int main()
|
|||||||
|
|
||||||
logger.log(INFO, "Program started.");
|
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";
|
std::cout << "Ping-\n";
|
||||||
|
|
||||||
logger.log(INFO, "App was pinged.");
|
logger.log(INFO, "App was pinged.");
|
||||||
|
|
||||||
res.set_content("Pong", "text/plain");
|
res.set_content("Pong", "text/plain");
|
||||||
|
|
||||||
httplib::Headers test = req.headers;
|
httplib::Headers test = req.headers;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Предполагается, что эти классы определены где-то еще
|
||||||
AuthorizationService authorization_service;
|
AuthorizationService authorization_service;
|
||||||
|
|
||||||
FileProcessingService file_processing;
|
FileProcessingService file_processing;
|
||||||
|
|
||||||
//PublishController publish_controller(svr, authorization_service, 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';
|
std::cout << "Server is running at http://localhost:8080" << '\n';
|
||||||
|
|||||||
Reference in New Issue
Block a user