@@ -198,38 +198,37 @@ std::string BCLog::Logger::LogTimestampStr(const std::string &str)
198
198
return strStamped;
199
199
}
200
200
201
- int BCLog::Logger::LogPrintStr (const std::string &str)
201
+ void BCLog::Logger::LogPrintStr (const std::string &str)
202
202
{
203
- int ret = 0 ; // Returns total number of characters written
204
-
205
203
std::string strTimestamped = LogTimestampStr (str);
206
204
207
205
if (m_print_to_console) {
208
206
// print to console
209
- ret = fwrite (strTimestamped.data (), 1 , strTimestamped.size (), stdout);
207
+ fwrite (strTimestamped.data (), 1 , strTimestamped.size (), stdout);
210
208
fflush (stdout);
211
209
}
212
210
if (m_print_to_file) {
213
211
std::lock_guard<std::mutex> scoped_lock (m_file_mutex);
214
212
215
213
// buffer if we haven't opened the log yet
216
214
if (m_fileout == nullptr ) {
217
- ret = strTimestamped.length ();
218
215
m_msgs_before_open.push_back (strTimestamped);
219
216
}
220
217
else
221
218
{
222
219
// reopen the log file, if requested
223
220
if (m_reopen_file) {
224
221
m_reopen_file = false ;
225
- if (fsbridge::freopen (m_file_path," a" ,m_fileout) != nullptr )
226
- setbuf (m_fileout, nullptr ); // unbuffered
222
+ m_fileout = fsbridge::freopen (m_file_path, " a" , m_fileout);
223
+ if (!m_fileout) {
224
+ return ;
225
+ }
226
+ setbuf (m_fileout, nullptr ); // unbuffered
227
227
}
228
228
229
- ret = FileWriteStr (strTimestamped, m_fileout);
229
+ FileWriteStr (strTimestamped, m_fileout);
230
230
}
231
231
}
232
- return ret;
233
232
}
234
233
235
234
void BCLog::Logger::ShrinkDebugFile ()
0 commit comments