Refactor logging levels: change LOG_INFO to LOG_DEBUG in Client destructor and LOG_INFO to LOG_TRACE in ServerConfig for improved log granularity
This commit is contained in:
parent
ebe67abf03
commit
58edbe86be
@ -1,3 +1,4 @@
|
||||
#include "webserv/log/LogLevel.hpp"
|
||||
#include "webserv/socket/Socket.hpp"
|
||||
|
||||
#include <webserv/client/Client.hpp>
|
||||
@ -12,7 +13,7 @@ Client::Client(std::unique_ptr<Socket> socket, Server &server, const ServerConfi
|
||||
|
||||
Client::~Client()
|
||||
{
|
||||
LOG_INFO("Client destructor called for fd: " + std::to_string(client_socket_->getFd()));
|
||||
LOG_DEBUG("Client destructor called for fd: " + std::to_string(client_socket_->getFd()));
|
||||
server_.removeFromEpoll(*client_socket_);
|
||||
};
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ void ServerConfig::parseServerBlock(const std::string &block)
|
||||
}
|
||||
// Optionally parse the server block here
|
||||
std::string locationBlock = block.substr(bracePos + 1, closeBrace - bracePos - 1);
|
||||
LOG_INFO("Added location: " + locationPath);
|
||||
LOG_TRACE("Added location: " + locationPath);
|
||||
locations_.emplace(locationPath, locationBlock);
|
||||
pos = closeBrace + 1;
|
||||
}
|
||||
@ -74,27 +74,27 @@ void ServerConfig::parseDirectives(const std::string &declarations)
|
||||
{
|
||||
throw std::runtime_error("Invalid port number: " + std::to_string(port_));
|
||||
}
|
||||
LOG_INFO("Set port to " + std::to_string(port_));
|
||||
LOG_TRACE("Set port to " + std::to_string(port_));
|
||||
}
|
||||
else if (directive == "root")
|
||||
{
|
||||
root_ = value;
|
||||
LOG_INFO("Set root to " + root_);
|
||||
LOG_TRACE("Set root to " + root_);
|
||||
}
|
||||
else if (directive == "host")
|
||||
{
|
||||
host_ = value;
|
||||
LOG_INFO("Set host to " + host_);
|
||||
LOG_TRACE("Set host to " + host_);
|
||||
}
|
||||
else if (directive == "cgi_pass")
|
||||
{
|
||||
cgi_pass_ = value;
|
||||
LOG_INFO("Set cgi_pass to " + cgi_pass_);
|
||||
LOG_TRACE("Set cgi_pass to " + cgi_pass_);
|
||||
}
|
||||
else if (directive == "cgi_ext")
|
||||
{
|
||||
cgi_ext_ = value;
|
||||
LOG_INFO("Set cgi_ext to " + cgi_ext_);
|
||||
LOG_TRACE("Set cgi_ext to " + cgi_ext_);
|
||||
}
|
||||
else if (directive == "index")
|
||||
{
|
||||
@ -103,7 +103,7 @@ void ServerConfig::parseDirectives(const std::string &declarations)
|
||||
while (lineStream >> indexFile)
|
||||
{
|
||||
index_files_.push_back(indexFile);
|
||||
LOG_INFO("Added index file: " + indexFile);
|
||||
LOG_TRACE("Added index file: " + indexFile);
|
||||
}
|
||||
}
|
||||
else if (directive == "error_page")
|
||||
@ -111,8 +111,7 @@ void ServerConfig::parseDirectives(const std::string &declarations)
|
||||
int statusCode = std::stoi(value);
|
||||
std::string errorPagePath;
|
||||
lineStream >> errorPagePath;
|
||||
error_page_[statusCode] = errorPagePath;
|
||||
LOG_INFO("Set error_page for status " + std::to_string(statusCode) + " to " + errorPagePath);
|
||||
LOG_TRACE("Set error_page for status " + std::to_string(statusCode) + " to " + errorPagePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#include "webserv/log/Log.hpp"
|
||||
|
||||
#include <webserv/config/ConfigManager.hpp>
|
||||
#include <webserv/config/LocationConfig.hpp>
|
||||
#include <webserv/config/ServerConfig.hpp>
|
||||
#include <webserv/log/Log.hpp>
|
||||
#include <webserv/log/LogLevel.hpp>
|
||||
#include <webserv/server/Server.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user