Subversion Repositories HomeAutomation

Rev

Rev 1959 | Rev 1964 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1959 Rev 1961
Line 29... Line 29...
29
 
29
 
30
namespace atom {
30
namespace atom {
31
namespace log {
31
namespace log {
32
 
32
 
33
static boost::mutex   mutex_;
33
static boost::mutex   mutex_;
34
static Level          level_ = LOG_LEVEL_ALL;
34
static Level          level_ = (Level)(LOG_LEVEL_ERROR | LOG_LEVEL_EXCEPTION | LOG_LEVEL_WARNING | LOG_LEVEL_INFO);
35
static const uint32_t kMaxBufferSize = 4096;
35
static const uint32_t kMaxBufferSize = 4096;
36
 
36
 
37
void SetLogLevel(Level level)
37
void SetLogLevel(Level level)
38
{
38
{
39
  level_ = level;
39
  level_ = level;
-
 
40
}
-
 
41
 
-
 
42
void SetLogLevelByString(std::string level_string)
-
 
43
{
-
 
44
  level_ = LOG_LEVEL_NONE;
-
 
45
 
-
 
46
  if (level_string.find("LOG_LEVEL_ERROR") != std::string::npos)
-
 
47
  {
-
 
48
    level_ = (Level)(level_ | LOG_LEVEL_ERROR);
-
 
49
  }
-
 
50
 
-
 
51
  if (level_string.find("LOG_LEVEL_EXCEPTION") != std::string::npos)
-
 
52
  {
-
 
53
    level_ = (Level)(level_ | LOG_LEVEL_EXCEPTION);
-
 
54
  }
-
 
55
 
-
 
56
  if (level_string.find("LOG_LEVEL_WARNING") != std::string::npos)
-
 
57
  {
-
 
58
    level_ = (Level)(level_ | LOG_LEVEL_WARNING);
-
 
59
  }
-
 
60
 
-
 
61
  if (level_string.find("LOG_LEVEL_INFO") != std::string::npos)
-
 
62
  {
-
 
63
    level_ = (Level)(level_ | LOG_LEVEL_INFO);
-
 
64
  }
-
 
65
 
-
 
66
  if (level_string.find("LOG_LEVEL_DEBUG") != std::string::npos)
-
 
67
  {
-
 
68
    level_ = (Level)(level_ | LOG_LEVEL_DEBUG);
-
 
69
  }
-
 
70
 
-
 
71
  if (level_string.find("LOG_LEVEL_ALL") != std::string::npos)
-
 
72
  {
-
 
73
    level_ = (Level)(level_ | LOG_LEVEL_ALL);
-
 
74
  }
40
}
75
}
41
 
76
 
42
void Print(Level level, std::string module, std::string message)
77
void Print(Level level, std::string module, std::string message)
43
{
78
{
44
  std::string               level_string;
79
  std::string               level_string;