Progress on Framework for Server software
[matches/MCTX3420.git] / server / log.h
1 /**
2  * @file log.h
3  * @purpose 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 #include <stdlib.h>
10 #include <stdio.h>
11 #include <stdbool.h>
12 #include <stdarg.h>
13 #include "common.h"
14
15 //To get around a 'pedantic' C99 rule that you must have at least 1 variadic arg, combine fmt into that.
16 #define Log(level, ...) LogEx(level, __func__, __VA_ARGS__)
17 #define Fatal(...) FatalEx(__func__, __VA_ARGS__)
18
19 // An enum to make the severity of log messages human readable in code
20 enum {LOGERR=0, LOGWARN=1, LOGNOTE=2, LOGINFO=3,LOGDEBUG=4};
21
22 extern void LogEx(int level, const char * funct, ...); // General function for printing log messages to stderr
23 extern void FatalEx(const char * funct, ...); // Function that deals with a fatal error (prints a message, then exits the program).
24
25 #endif //_LOG_H
26
27 //EOF

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