159 static const std::string msg_type_string(
MsgType msg_type,
bool full_format =
true);
165 Logger& set_context(
const char* file_name,
const char*
function,
const int line);
179 return *this << fmt::format(std::forward<T>(t)...);
181 THROW(ExcMessage() << EI_Message(
"FormatError: " + std::string(e.what())));
194 void print_to_screen(std::ostream& stream, std::stringstream& scr_stream,
StreamMask mask);
197 void print_to_file(std::ofstream& stream, std::stringstream& file_stream,
StreamMask mask);
200 bool print_screen_header(std::stringstream& scr_stream);
203 void print_file_header(std::stringstream& file_stream);
206 std::string compact_file_name(std::string file_name);
227 friend Logger &operator<<(Logger & log, const std::vector<T> &
vec);
242 Logger &operator<<(Logger & log, const std::vector<T> &
vec)
244 for (T
const& c :
vec)
265 Logger( type ).set_context( __FILE__, __func__, __LINE__) 267 #define MessageOut() \ 268 _LOG( Logger::MsgType::message ) 270 #define WarningOut() \ 271 _LOG( Logger::MsgType::warning ) 274 _LOG( Logger::MsgType::log ) 277 _LOG( Logger::MsgType::debug ) 284 #define print_var(var) \ 285 std::string(#var) << "=" << (var) << ", " Class for storing logger messages.
static StreamMask cout
Predefined mask of std::cout output.
std::stringstream cout_stream_
Store messages printed to cout output stream.
Logger & operator<<(Logger &log, StreamMask mask)
StreamMask streams_mask_
Mask of logger, specifies streams in actual time into which to be written.
StreamMask()
Empty constructor.
std::stringstream cerr_stream_
Store messages printed to cerr output stream.
std::string function_
Actual function.
StreamMask operator|(const StreamMask &other)
Logger & fmt(T &&...t)
Allow use functionality of fmtlib for formating message.
StreamMask(int mask)
Constructor set mask_ value.
static StreamMask cerr
Predefined mask of std::cerr output.
static StreamMask log
Predefined mask of log file output.
StreamMask operator&(const StreamMask &other)
Helper class, store mask specifying streams.
std::string date_time_
Actual date and time.
bool every_process_
Flag marked if log message is printing for all processes or only for zero process.
std::stringstream file_stream_
Store messages printed to file.
StreamMask full_streams_mask_
Mask of logger, specifies all streams into which to be written in logger message. ...
std::string file_name_
Actual file.
int mpi_rank_
Actual process (if MPI is supported)
MsgType type_
Type of message.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
MsgType
Enum of types of Logger messages.