From e21c3bb1408eea41d8f7c6dfbe2a58d023feada7 Mon Sep 17 00:00:00 2001 From: om Date: Fri, 7 Apr 2006 12:21:11 +0000 Subject: Slight optimisation to config reader, looks nicer even if it's not faster. Make ./inspircd script use -nolog (it already used -debug, which didn't exist until now!?) Add commandline options -nolog and -debug, -debug forces all log messages to be output regardless of level. -nolog stops the logfile being written, so you can run with -debug without filling up your disk. make clean && make install, apparently some of the core doesn't depend on inspircd_io.h in the makefiles..so it'll probably segfault if you don't. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3841 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/helperfuncs.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/helperfuncs.cpp') diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 034976fb7..46a85da2c 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -77,7 +77,8 @@ void log(int level, char *text, ...) va_list argsPtr; char textbuffer[MAXBUF]; - if (level < Config->LogLevel) + /* If we were given -debug we output all messages, regardless of configured loglevel */ + if ((level < Config->LogLevel) && !Config->forcedebug) return; if (TIME != LAST) @@ -95,13 +96,13 @@ void log(int level, char *text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - if (Config->log_file) + if (Config->writelog) fprintf(Config->log_file,"%s %s\n",TIMESTR,textbuffer); - - if (Config->nofork) - { - printf("%s %s\n", TIMESTR, textbuffer); - } + } + + if (Config->nofork) + { + printf("%s %s\n", TIMESTR, textbuffer); } } -- cgit v1.3.1-10-gc9f91