Rev 1947 | Rev 1959 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1947 | Rev 1950 | ||
|---|---|---|---|
| Line 30... | Line 30... | ||
| 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_ = LOG_LEVEL_ALL; |
| - | 35 | static const uint32_t kMaxBufferSize = 4096; |
|
| 35 | 36 | ||
| 36 | void SetLogLevel(Level level) |
37 | void SetLogLevel(Level level) |
| 37 | { |
38 | { |
| 38 | level_ = level; |
39 | level_ = level; |
| 39 | } |
40 | } |
| Line 92... | Line 93... | ||
| 92 | mutex_.unlock(); |
93 | mutex_.unlock(); |
| 93 | } |
94 | } |
| 94 | 95 | ||
| 95 | void Info(std::string module, char* format, ...) |
96 | void Info(std::string module, char* format, ...) |
| 96 | { |
97 | { |
| 97 | char buffer[ |
98 | char buffer[kMaxBufferSize]; |
| 98 | va_list parameters; |
99 | va_list parameters; |
| 99 | 100 | ||
| 100 | 101 | ||
| 101 | /* Initialize variables */ |
102 | /* Initialize variables */ |
| 102 | memset(&buffer[0], 0, sizeof(buffer)); |
103 | memset(&buffer[0], 0, sizeof(buffer)); |
| Line 115... | Line 116... | ||
| 115 | Print(LOG_LEVEL_INFO, module, message); |
116 | Print(LOG_LEVEL_INFO, module, message); |
| 116 | } |
117 | } |
| 117 | 118 | ||
| 118 | void Debug(std::string module, char* format, ...) |
119 | void Debug(std::string module, char* format, ...) |
| 119 | { |
120 | { |
| 120 | char buffer[ |
121 | char buffer[kMaxBufferSize]; |
| 121 | va_list parameters; |
122 | va_list parameters; |
| 122 | 123 | ||
| 123 | 124 | ||
| 124 | /* Initialize variables */ |
125 | /* Initialize variables */ |
| 125 | memset(&buffer[0], 0, sizeof(buffer)); |
126 | memset(&buffer[0], 0, sizeof(buffer)); |
| Line 138... | Line 139... | ||
| 138 | Print(LOG_LEVEL_DEBUG, module, message); |
139 | Print(LOG_LEVEL_DEBUG, module, message); |
| 139 | } |
140 | } |
| 140 | 141 | ||
| 141 | void Error(std::string module, char* format, ...) |
142 | void Error(std::string module, char* format, ...) |
| 142 | { |
143 | { |
| 143 | char buffer[ |
144 | char buffer[kMaxBufferSize]; |
| 144 | va_list parameters; |
145 | va_list parameters; |
| 145 | 146 | ||
| 146 | 147 | ||
| 147 | /* Initialize variables */ |
148 | /* Initialize variables */ |
| 148 | memset(&buffer[0], 0, sizeof(buffer)); |
149 | memset(&buffer[0], 0, sizeof(buffer)); |
| Line 161... | Line 162... | ||
| 161 | Print(LOG_LEVEL_ERROR, module, message); |
162 | Print(LOG_LEVEL_ERROR, module, message); |
| 162 | } |
163 | } |
| 163 | 164 | ||
| 164 | void Warning(std::string module, char* format, ...) |
165 | void Warning(std::string module, char* format, ...) |
| 165 | { |
166 | { |
| 166 | char buffer[ |
167 | char buffer[kMaxBufferSize]; |
| 167 | va_list parameters; |
168 | va_list parameters; |
| 168 | 169 | ||
| 169 | 170 | ||
| 170 | /* Initialize variables */ |
171 | /* Initialize variables */ |
| 171 | memset(&buffer[0], 0, sizeof(buffer)); |
172 | memset(&buffer[0], 0, sizeof(buffer)); |