The ROme OpTimistic Simulator  3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
log.h
Go to the documentation of this file.
1 
11 #pragma once
12 
13 #include <stdbool.h>
14 
15 #ifndef LOG_LEVEL
16 
18 #define LOG_LEVEL LOG_TRACE
19 #endif
20 
21 extern int log_level;
22 extern bool log_colored;
23 
25 #define LOG_TRACE 0
26 #define LOG_DEBUG 1
28 #define LOG_INFO 2
30 #define LOG_WARN 3
32 #define LOG_ERROR 4
34 #define LOG_FATAL 5
36 
42 #define log_can_log(lvl) ((lvl) >= LOG_LEVEL && (lvl) >= log_level)
43 
49 #define log_log(lvl, ...) \
50  do { \
51  if(log_can_log(lvl)) \
52  _log_log(lvl, __FILE__, __LINE__, __VA_ARGS__); \
53  } while(0)
54 
55 void _log_log(int level, const char *file, unsigned line, const char *fmt, ...);
56 
57 void log_logo_print(void);
log_level
int log_level
The minimum log level of the messages to display.
Definition: log.c:19
_log_log
void _log_log(int level, const char *file, unsigned line, const char *fmt,...)
Logs a message. For internal use: log_log() should be used instead.
Definition: log.c:44
log_colored
bool log_colored
If set, uses color codes to color the log outputs.
Definition: log.c:21
log_logo_print
void log_logo_print(void)
Prints a fancy ROOT-Sim logo on the terminal.
Definition: log.c:82