- Added LogLevel parameter to Channel constructor and updated derived classes (FileChannel, StdoutChannel) to accept it. - Modified log methods to respect the logging level, preventing lower priority logs from being processed. - Updated Log class to set logging levels for stdout and file channels. - Adjusted main function to initialize logging with specified levels.
26 lines
661 B
C++
26 lines
661 B
C++
#include "webserv/log/Log.hpp"
|
|
|
|
#include <webserv/config/ConfigManager.hpp>
|
|
#include <webserv/config/LocationConfig.hpp>
|
|
#include <webserv/config/ServerConfig.hpp>
|
|
#include <webserv/server/Server.hpp>
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
|
|
if (argc < 2)
|
|
{
|
|
std::cerr << "Usage: " << argv[0] << " <config_file_path>\n"; // NOLINT
|
|
return 1;
|
|
}
|
|
Log::setFileChannel("webserv.log", LogLevel::LOGLVL_WARN);
|
|
Log::setStdoutChannel(LogLevel::LOGLVL_TRACE);
|
|
ConfigManager::getInstance().init(argv[1]); // NOLINT
|
|
Server server(ConfigManager::getInstance());
|
|
server.start();
|
|
|
|
return 0;
|
|
} |