11#include "mcrl2/utilities/logger.h"
23 std::array<
char, 11> buffer{};
24 std::size_t res = strftime(buffer.data(), buffer.size(),
"%H:%M:%S", r);
27 std::clog <<
"Could not write time to buffer" <<
std::endl;
34 const time_t timestamp,
35 const std::string& msg,
36 const bool print_time_information)
41 std::stringstream start_of_line;
42 if (print_time_information || print_log_level)
46 if (print_time_information)
50 if (print_time_information && print_log_level)
56 start_of_line << log_level_to_string(level);
58 if (print_time_information || print_log_level)
60 start_of_line <<
"] ";
64 start_of_line << std::string(7 - log_level_to_string(level).size(),
' ');
68 bool msg_ends_with_newline =
false;
71 msg_ends_with_newline = (msg[msg.size()-1] ==
'\n');
74 std::stringstream result;
78 bool overwrite =
false;
87 result <<
"\r" << start_of_line.str();
98 result <<
"\n" << start_of_line.str();
104 result << start_of_line.str();
109 for (std::string::const_iterator it = msg.begin(); it != msg.end(); )
118 if (++it != msg.end())
120 result <<
"\n" << start_of_line.str();
122 last_caret_pos() = 0;
139 if(msg_ends_with_newline)
std::string format_time(const time_t *t)
log_level_t
Log levels that are supported.
std::size_t operator()(const std::vector< X > &v) const