simplelogger_defs.h
Go to the documentation of this file.
1 /*
2  * Simple logging framework.
3  *
4  * License: Unlicense(http://unlicense.org)
5  *
6  * Find the latest version at https://github.com/rm5248/simplelogger
7  *
8  * Definitions for library usage. This is the file that must be distributed
9  * if you are using the Simplelogger in a library.
10  */
11 #ifndef SIMPLELOGGER_DEFS_H
12 #define SIMPLELOGGER_DEFS_H
13 
19  const char* function;
20  const char* file;
21 };
22 
32  SL_FATAL
33 };
34 
38 typedef void ( *simplelogger_log_function )( const char* logger_name,
39  const struct SL_LogLocation* location,
40  const enum SL_LogLevel level,
41  const char* log_string );
42 
43 
44 #define SL_LOGLEVEL_TO_STRING( stringPtr, level ) do{\
45  switch( level ){ \
46  case SL_TRACE: stringPtr = "TRACE"; break;\
47  case SL_DEBUG: stringPtr = "DEBUG"; break;\
48  case SL_INFO: stringPtr = "INFO"; break;\
49  case SL_WARN: stringPtr = "WARN"; break;\
50  case SL_ERROR: stringPtr = "ERROR"; break;\
51  case SL_FATAL: stringPtr = "FATAL"; break;\
52  default: stringPtr = "UNKN"; break;\
53  }}while(0)
54 
55 
56 #endif /* SIMPLELOGGER_DEFS_H */
void(* simplelogger_log_function)(const char *logger_name, const struct SL_LogLocation *location, const enum SL_LogLevel level, const char *log_string)
Pointer to a function that does the actual log operation.
Definition: simplelogger_defs.h:38
SL_LogLevel
Level of the log message.
Definition: simplelogger_defs.h:26
@ SL_INFO
Definition: simplelogger_defs.h:29
@ SL_ERROR
Definition: simplelogger_defs.h:31
@ SL_TRACE
Definition: simplelogger_defs.h:27
@ SL_FATAL
Definition: simplelogger_defs.h:32
@ SL_WARN
Definition: simplelogger_defs.h:30
@ SL_DEBUG
Definition: simplelogger_defs.h:28
Where the log message was generated from.
Definition: simplelogger_defs.h:17
int line_number
Definition: simplelogger_defs.h:18
const char * file
Definition: simplelogger_defs.h:20