webserv/webserv/main.cpp
whaffman bac66d2a0b Implement logging level support in Channel and its derived classes
- 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.
2025-09-21 20:49:25 +02:00

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;
}