Add usleep to strain.c just in case...
[matches/MCTX3420.git] / server / log.h
1 /**
2  * @file log.h
3  * @brief Declaration of functions for printing log messages and/or terminating program after a fatal error
4  */
5
6 #ifndef _LOG_H
7 #define _LOG_H
8
9 //To get around a 'pedantic' C99 rule that you must have at least 1 variadic arg, combine fmt into that.
10 #define Log(level, ...) LogEx(level, __func__, __FILE__, __LINE__, __VA_ARGS__)
11 #define Fatal(...) FatalEx(__func__, __FILE__, __LINE__, __VA_ARGS__)
12
13 /*** Macro to abort function ***/
14 #define Abort(...) { LogEx(LOGERR, __func__, __FILE__, __LINE__, __VA_ARGS__); return; }
15 #define AbortBool(...) { LogEx(LOGERR, __func__, __FILE__, __LINE__, __VA_ARGS__); return false; }
16
17 /** An enum to make the severity of log messages human readable in code **/
18 enum {LOGERR=0, LOGWARN=1, LOGNOTE=2, LOGINFO=3,LOGDEBUG=4};
19
20 extern void LogEx(int level, const char * funct, const char * file, int line,  ...); // General function for printing log messages to stderr
21 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).
22
23 #endif //_LOG_H
24
25 //EOF

UCC git Repository :: git.ucc.asn.au