| 31 | } |
| 32 | |
| 33 | bool BCLog::Logger::OpenDebugLog() |
| 34 | { |
| 35 | std::lock_guard<std::mutex> scoped_lock(m_file_mutex); |
| 36 | |
| 37 | assert(m_fileout == nullptr); |
| 38 | assert(!m_file_path.empty()); |
| 39 | |
| 40 | m_fileout = fsbridge::fopen(m_file_path, "a"); |
| 41 | if (!m_fileout) { |
| 42 | return false; |
| 43 | } |
| 44 | |
| 45 | setbuf(m_fileout, nullptr); // unbuffered |
| 46 | // dump buffered messages from before we opened the log |
| 47 | while (!m_msgs_before_open.empty()) { |
| 48 | FileWriteStr(m_msgs_before_open.front(), m_fileout); |
| 49 | m_msgs_before_open.pop_front(); |
| 50 | } |
| 51 | |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | void BCLog::Logger::EnableCategory(BCLog::LogFlags flag) |
| 56 | { |
no test coverage detected