X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Flog.h;h=e4fd17fbdc93a143847b42f2fc70809b6d249791;hb=828cdbf49f52572e93c5c5a48e05277525a4055f;hp=eec5e5398cd73316129e7d1f88d810b779e04836;hpb=8aa358c02e86aee0486c1951ee3c5634cb7586a1;p=matches%2FMCTX3420.git diff --git a/server/log.h b/server/log.h index eec5e53..e4fd17f 100644 --- a/server/log.h +++ b/server/log.h @@ -7,14 +7,18 @@ #define _LOG_H //To get around a 'pedantic' C99 rule that you must have at least 1 variadic arg, combine fmt into that. -#define Log(level, ...) LogEx(level, __func__, __VA_ARGS__) -#define Fatal(...) FatalEx(__func__, __VA_ARGS__) +#define Log(level, ...) LogEx(level, __func__, __FILE__, __LINE__, __VA_ARGS__) +#define Fatal(...) FatalEx(__func__, __FILE__, __LINE__, __VA_ARGS__) -// An enum to make the severity of log messages human readable in code +/*** Macro to abort function ***/ +#define Abort(...) { LogEx(LOGERR, __func__, __FILE__, __LINE__, __VA_ARGS__); return; } +#define AbortBool(...) { LogEx(LOGERR, __func__, __FILE__, __LINE__, __VA_ARGS__); return false; } + +/** An enum to make the severity of log messages human readable in code **/ enum {LOGERR=0, LOGWARN=1, LOGNOTE=2, LOGINFO=3,LOGDEBUG=4}; -extern void LogEx(int level, const char * funct, ...); // General function for printing log messages to stderr -extern void FatalEx(const char * funct, ...); // Function that deals with a fatal error (prints a message, then exits the program). +extern void LogEx(int level, const char * funct, const char * file, int line, ...); // General function for printing log messages to stderr +extern void FatalEx(const char * funct, const char * file, int line, ...); // Function that deals with a fatal error (prints a message, then exits the program). #endif //_LOG_H