diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/helperfuncs.cpp | 28 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_operlog.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_remove.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_testcommand.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_watch.cpp | 1 |
6 files changed, 20 insertions, 14 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index b25370df6..97cb68f33 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -65,11 +65,20 @@ static time_t LAST = 0; * Write a line of text `text' to the logfile (and stdout, if in nofork) if the level `level' * is greater than the configured loglevel. */ -void do_log(int level, const char *text, ...) +void InspIRCd::Log(int level, const char* text, ...) { va_list argsPtr; char textbuffer[MAXBUF]; + va_start(argsPtr, text); + vsnprintf(textbuffer, MAXBUF, text, argsPtr); + va_end(argsPtr); + + InspIRCd::Log(level, std::string(textbuffer)); +} + +void InspIRCd::Log(int level, const std::string &text) +{ if (!ServerInstance || !ServerInstance->Config) return; @@ -86,22 +95,15 @@ void do_log(int level, const char *text, ...) LAST = TIME; } - if (ServerInstance->Config->log_file) + if (ServerInstance->Config->log_file && ServerInstance->Config->writelog) { - va_start(argsPtr, text); - vsnprintf(textbuffer, MAXBUF, text, argsPtr); - va_end(argsPtr); - - if (ServerInstance->Config->writelog) - { - fprintf(ServerInstance->Config->log_file,"%s %s\n",TIMESTR,textbuffer); - fflush(ServerInstance->Config->log_file); - } + fprintf(ServerInstance->Config->log_file,"%s %s\n",TIMESTR,text.c_str()); + fflush(ServerInstance->Config->log_file); } - + if (ServerInstance->Config->nofork) { - printf("%s %s\n", TIMESTR, textbuffer); + printf("%s %s\n", TIMESTR, text.c_str()); } } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 3a1bccaf7..4fcb0be13 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -25,6 +25,7 @@ #include "modules.h" #include "helperfuncs.h" #include "dns.h" +#include "inspircd.h" /* $ModDesc: Change user's hosts connecting from known CGI:IRC hosts */ diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 8188c49b1..4881eefa0 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -20,7 +20,7 @@ using namespace std; #include "channels.h" #include "modules.h" #include "helperfuncs.h" -#include "message.h" +#include "inspircd.h" #include <vector> /* $ModDesc: A module which logs all oper commands to the ircd log at default loglevel. */ diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index a9c478a89..a5657f604 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -7,6 +7,7 @@ #include "channels.h" #include "modules.h" #include "helperfuncs.h" +#include "inspircd.h" /* $ModDesc: Provides a /remove command, this is mostly an alternative to /kick, except makes users appear to have parted the channel */ diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index 6f517e8ce..9b3509f8d 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -22,6 +22,7 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" #include "dns.h" +#include "inspircd.h" /* $ModDesc: Povides a proof-of-concept test /WOOT command */ diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 888827cfa..2ba9c9afb 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -24,6 +24,7 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" #include "hashcomp.h" +#include "inspircd.h" /* $ModDesc: Provides support for the /watch command */ |