Commit 35c0782c authored by Marco Amagliani's avatar Marco Amagliani
Browse files

Added option to control the log file output.

parent 4583a71d
......@@ -119,7 +119,7 @@ public:
std::cerr << _c; // print on the console
if (_c == '\n')
{
std::cout << std::flush;
std::cerr << std::flush;
line_strt_ = true;
}
}
......@@ -180,6 +180,14 @@ public:
return prev_val;
}
bool enable_file_log(const bool _enbl)
{
auto prev_val = enbl_file_log_;
enbl_file_log_ = _enbl;
return prev_val;
}
void print(double _d)
{
char buffer[64];
......@@ -311,6 +319,9 @@ public:
bool flush()
{
if (!enbl_file_log_)
return true;
if (bffr_.empty())
return true;
......@@ -393,7 +404,8 @@ private:
int num_flush_;
int priority_; // Last permission granted
bool line_strt_; // are we at the start of th line?
bool enbl_cnsl_ = true; // prints also on cerr
bool enbl_cnsl_ = true; // prints on cerr
bool enbl_file_log_ = true; // creates a debug log file
std::string bffr_;
std::string output_;
......@@ -441,6 +453,11 @@ bool File::enable_console_output(const bool _enbl)
return impl_->enable_console_output(_enbl);
}
bool File::enable_file_log(const bool _enbl)
{
return impl_->enable_file_log(_enbl);
}
}//namespace Debug
#endif // DEB_ON
......@@ -44,6 +44,7 @@ public:
void set_double_format(const char* const str);
bool enable_console_output(const bool _enbl);
bool enable_file_log(const bool _enbl);
private:
class Impl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment