- * ---------------------------------------------------
- */
-
-#include <stdarg.h>
-#include "inspircd_config.h"
-#include "inspircd.h"
-#include "configreader.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/errno.h>
-#include <signal.h>
-#include <time.h>
-#include <string>
-#include <sstream>
-#ifdef HAS_EXECINFO
-#include <execinfo.h>
-#endif
-#include "connection.h"
-#include "users.h"
-#include "ctables.h"
-#include "globals.h"
-#include "modules.h"
-#include "dynamic.h"
-#include "wildcard.h"
-#include "message.h"
-#include "mode.h"
-#include "xline.h"
-#include "commands.h"
-#include "inspstring.h"
-#include "helperfuncs.h"
-#include "hashcomp.h"
-#include "typedefs.h"
-
-extern int MODCOUNT;
-extern ModuleList modules;
-extern InspIRCd* ServerInstance;
-extern time_t TIME;
-extern char lowermap[255];
-extern userrec* fd_ref_table[MAX_DESCRIPTORS];
-extern std::vector<userrec*> all_opers;
-extern user_hash clientlist;
-extern chan_hash chanlist;
-
-char LOG_FILE[MAXBUF];
-
-extern std::vector<userrec*> local_users;
-
-static char TIMESTR[26];
-static time_t LAST = 0;
-
-/** log()
- * 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, ...)
-{
- va_list argsPtr;
- char textbuffer[MAXBUF];
-
- if (!ServerInstance || !ServerInstance->Config)
- return;
-
- /* If we were given -debug we output all messages, regardless of configured loglevel */
- if ((level < ServerInstance->Config->LogLevel) && !ServerInstance->Config->forcedebug)
- return;
-
- if (TIME != LAST)
- {
- struct tm *timeinfo = localtime(&TIME);
-
- strlcpy(TIMESTR,asctime(timeinfo),26);
- TIMESTR[24] = ':';
- LAST = TIME;
- }
-
- if (ServerInstance->Config->log_file)
- {
- 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);
- }
- }
-
- if (ServerInstance->Config->nofork)
- {
- printf("%s %s\n", TIMESTR, textbuffer);
- }
-}
-
-/** readfile()
- * Read the contents of a file located by `fname' into a file_cache pointed at by `F'.