Skip to content
Snippets Groups Projects
Commit 31a6d3d0 authored by Alejandro Domínguez's avatar Alejandro Domínguez
Browse files

Deduplicate IO instructions in printer::print_msg

parent 3ab11077
No related branches found
No related tags found
No related merge requests found
......@@ -190,18 +190,10 @@ void printer::print_msg(verbosity verbose, const char* fmt, ...)
buf[bpos] = '\n';
buf[bpos+1] = '\0';
std::unique_lock<std::mutex> lck(print_mutex);
fputs(buf, stdout);
fflush(stdout);
if(logfile != nullptr)
{
fputs(buf, logfile);
fflush(logfile);
}
print_str(buf);
}
void printer::print_str(const char* str)
inline void printer::print_str(const char* str)
{
std::unique_lock<std::mutex> lck(print_mutex);
fputs(str, stdout);
......
......@@ -36,7 +36,7 @@ public:
inline void set_verbose_level(size_t level) { verbose_level = (verbosity)level; }
void print_msg(verbosity verbose, const char* fmt, ...);
void print_str(const char* str);
inline void print_str(const char* str);
bool open_logfile(const char* file);
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment