dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / scd_logging.cpp
1 #include <iostream>
2 #include <string>
3
4 #include "scd_logging.h"
5
6 static scd_loglevel _curr_level = SCD_INFO;
7
8 void scd_log(const scd_loglevel &level, const string &str)
9 {
10     std::ostream &out = std::clog;
11
12     if (_curr_level > level)
13         return;
14
15     switch(level)
16     {
17     case SCD_DEBUG:
18         out << "debug: ";
19         break;
20     case SCD_INFO:
21         out << "info: ";
22         break;
23     case SCD_WARN:
24         out << "warn: ";
25         break;
26     case SCD_ERROR:
27         out << "error: ";
28         break;
29     default:
30         out << "unknown: ";
31         break;
32     }
33
34     out << str << std::endl;
35 }
36
37 void scd_set_loglevel(const scd_loglevel &level)
38 {
39     _curr_level = level;
40 }