dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / scd_logging.h
1 #ifndef SCD_LOGGING_H
2 #define SCD_LOGGING_H
3
4 #include <string>
5 using std::string;
6
7 /* Loglevels. Default is SCD_INFO */
8 typedef int scd_loglevel;
9 const scd_loglevel SCD_DEBUG = 0;
10 const scd_loglevel SCD_INFO = 1;
11 const scd_loglevel SCD_WARN = 2;
12 const scd_loglevel SCD_ERROR = 3;
13
14 /**
15  * Log message if the current loglevel is low enough.
16  */
17 void scd_log(const scd_loglevel &level, const string &str);
18
19 /**
20  * Log message with loglevel SCD_DEBUG.
21  */
22 inline void scd_debug(const string &str)
23 {
24     scd_log(SCD_DEBUG, str);
25 }
26
27 /**
28  * Log message with loglevel SCD_INFO.
29  */
30 inline void scd_info(const string &str)
31 {
32     scd_log(SCD_INFO, str);
33 }
34
35 /**
36  * Log message with loglevel SCD_WARN.
37  */
38 inline void scd_warn(const string &str)
39 {
40     scd_log(SCD_WARN, str);
41 }
42
43 /**
44  * Log message with loglevel SCD_ERROR.
45  */
46 inline void scd_error(const string &str)
47 {
48     scd_log(SCD_ERROR, str);
49 }
50
51 /**
52  * Set the current loglevel. Events with lower priorities are not logged.
53  */
54 void scd_set_loglevel(const scd_loglevel &level);
55
56 #endif