X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Flog.h;h=cc6a7e506a03e5b14f739238ce58112b99e2bc9b;hb=10a0d0813cab99327bcb7f7fcb0008c783cfc685;hp=005059c1c399725b94287a409567c1673c4a99e1;hpb=259624013535f3c93315868efb5f6f611ba88470;p=matches%2FMCTX3420.git diff --git a/server/log.h b/server/log.h index 005059c..cc6a7e5 100644 --- a/server/log.h +++ b/server/log.h @@ -1,26 +1,23 @@ /** * @file log.h - * @purpose Declaration of functions for printing log messages and/or terminating program after a fatal error + * @brief Declaration of functions for printing log messages and/or terminating program after a fatal error */ #ifndef _LOG_H #define _LOG_H -#include -#include -#include -#include -#include "common.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__) + +/*** Macro to abort function ***/ +#define Abort(...) LogEx(LOGERR, __func__, __FILE__, __LINE__, __VA_ARGS__); return // 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