🏗️」 wip: passed _log to a global pointer

This commit is contained in:
2025-04-18 10:09:46 +02:00
parent 0b77d7b80c
commit a2cf80bfde
12 changed files with 52 additions and 35 deletions

View File

@ -6,12 +6,14 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/03 15:45:07 by mmoussou #+# #+# */
/* Updated: 2025/04/17 14:29:29 by adjoly ### ########.fr */
/* Updated: 2025/04/18 09:57:10 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <config/default.hpp>
#include <csignal>
#include <server/default.hpp>
#include <config/Config.hpp>
#include <cstdlib>
#include <exception>
#include <help.hpp>
@ -20,6 +22,12 @@
#include <unistd.h>
#include <webserv.hpp>
int _sig = 0;
void ft_sig(int sig) {
_sig = sig;
}
int main(int ac, char **av) {
if (help(ac, av)) {
return EXIT_SUCCESS;
@ -30,13 +38,19 @@ int main(int ac, char **av) {
return EXIT_FAILURE;
}
config::Server *conf;
config::Config *conf;
try {
conf = new config::Config(std::string(av[1]));
std::string str = av[1];
conf = new config::Config(str);
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
return 1;
}
if (signal(SIGINT, &ft_sig) == SIG_ERR) {
conf->getLogger()->error("could not bind sigint :(");
return EXIT_FAILURE;
}
webserv::Server *serv = new webserv::Server(conf);