MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / _flush

Method _flush

LogManager.cpp:147–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void LogManager::_flush()
148{
149 /*-------------------------------------------------*\
150 | If the log is open, write out buffered messages |
151 \*-------------------------------------------------*/
152 if(log_stream.is_open())
153 {
154 for(size_t msg = 0; msg < temp_messages.size(); ++msg)
155 {
156 if(temp_messages[msg]->level <= loglevel || temp_messages[msg]->level == LL_DIALOG)
157 {
158 // Put the timestamp here
159 std::chrono::milliseconds counter = std::chrono::duration_cast<std::chrono::milliseconds>(temp_messages[msg]->counted_second);
160 log_stream << std::left << std::setw(6) << counter.count() << "|";
161 log_stream << std::left << std::setw(9) << log_codes[temp_messages[msg]->level];
162 log_stream << temp_messages[msg]->buffer;
163
164 if(print_source)
165 {
166 log_stream << " [" << temp_messages[msg]->filename << ":" << temp_messages[msg]->line << "]";
167 }
168
169 log_stream << std::endl;
170 }
171 }
172
173 /*-------------------------------------------------*\
174 | Clear temp message buffers after writing them out |
175 \*-------------------------------------------------*/
176 temp_messages.clear();
177 }
178
179 /*-------------------------------------------------*\
180 | Flush the stream |
181 \*-------------------------------------------------*/
182 log_stream.flush();
183}
184
185void LogManager::flush()
186{

Callers

nothing calls this directly

Calls 4

is_openMethod · 0.80
flushMethod · 0.80
sizeMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected