mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-11 00:08:46 +02:00
「✨」 feat: added debug function in log class
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/20 09:28:27 by adjoly #+# #+# */
|
/* Created: 2025/03/20 09:28:27 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/22 14:46:05 by adjoly ### ########.fr */
|
/* Updated: 2025/04/22 16:14:25 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -109,6 +109,19 @@ class Logger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void debug(const std::string &msg) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::string ss = printPogitMsg("🏗️", "webserv", "debug", msg);
|
||||||
|
std::cerr << ss << std::endl;
|
||||||
|
if (!_ttyOnly) {
|
||||||
|
_file << ss << std::endl;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
(void)msg;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
std::string printPogitMsg(const std::string &emoji, const std::string &type,
|
std::string printPogitMsg(const std::string &emoji, const std::string &type,
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */
|
/* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/22 11:46:07 by mmoussou ### ########.fr */
|
/* Updated: 2025/04/22 16:14:36 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include <server/Client.hpp>
|
#include <server/Client.hpp>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <server/default.hpp>
|
#include <server/default.hpp>
|
||||||
|
#include <sstream>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
using namespace webserv::server;
|
using namespace webserv::server;
|
||||||
@ -58,6 +59,9 @@ int Server::_createSocket(std::string host, int port) {
|
|||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
convertStringToIP(host.c_str(), &addr.sin_addr);
|
convertStringToIP(host.c_str(), &addr.sin_addr);
|
||||||
|
std::stringstream str;
|
||||||
|
str << port;
|
||||||
|
_log->debug("port : " + str.str());
|
||||||
addr.sin_port = htons(port);
|
addr.sin_port = htons(port);
|
||||||
|
|
||||||
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||||
|
Reference in New Issue
Block a user