Flow123d
JB_transport-9331eee
|
Go to the documentation of this file.
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())));
244 for (T
const& c :
vec)
249 template <
class T,
long unsigned int N>
252 for (T
const& c :
vec)
273 Logger( type ).set_context( __FILE__, __func__, __LINE__)
275 #define MessageOut() \
276 _LOG( Logger::MsgType::message )
278 #define WarningOut() \
279 _LOG( Logger::MsgType::warning )
282 _LOG( Logger::MsgType::log )
285 _LOG( Logger::MsgType::debug )
292 #define print_var(var) \
293 std::string(#var) << "=" << (var) << ", "
303 template <
typename Cont,
typename Delim=const
char*>
312 auto f = begin(manip.
_v), l(end(manip.
_v));
316 if ((os << *f) && (++f != l))
324 template <
typename T,
typename Delim=const
char*>
manipulators::Array< T, Delim > format(T const &deduce, Delim delim=", ")
Logger & operator<<(Logger &log, StreamMask mask)
StreamMask streams_mask_
Mask of logger, specifies streams in actual time into which to be written.
static StreamMask cerr
Predefined mask of std::cerr output.
static const std::string msg_type_string(MsgType msg_type, bool full_format=true)
Return string value of given MsgType in full or shorter format (e.g. "WARNING" of "Wrn")
Helper class, store mask specifying streams.
static StreamMask log
Predefined mask of log file output.
bool every_process_
Flag marked if log message is printing for all processes or only for zero process.
friend Logger & operator<<(Logger &log, const T &x)
std::stringstream cerr_stream_
Store messages printed to cerr output stream.
std::stringstream file_stream_
Store messages printed to file.
void print_to_screen(std::ostream &stream, std::stringstream &scr_stream, StreamMask mask)
Print formated message to given screen stream if mask corresponds with streams_mask_.
std::string file_name_
Actual file.
bool print_screen_header(std::stringstream &scr_stream)
Print header to screen stream, helper method called from print_to_screen.
StreamMask operator&(const StreamMask &other)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Logger & every_proc()
Set flag every_process_ to true.
StreamMask full_streams_mask_
Mask of logger, specifies all streams into which to be written in logger message.
Logger(MsgType type)
Constructor.
std::string compact_file_name(std::string file_name)
Return compact (relative) path to the given source file.
Logger & fmt(T &&... t)
Allow use functionality of fmtlib for formating message.
std::string date_time_
Actual date and time.
void set_mask()
Set streams_mask_ according to the type of message.
MsgType type_
Type of message.
void print_to_file(std::ofstream &stream, std::stringstream &file_stream, StreamMask mask)
Print formated message to given file stream if mask corresponds with streams_mask_.
fmt::BufferedFile & move(fmt::BufferedFile &f)
Logger & set_context(const char *file_name, const char *function, const int line)
Stores values for printing out line number, function, etc.
MsgType
Enum of types of Logger messages.
static StreamMask cout
Predefined mask of std::cout output.
std::stringstream cout_stream_
Store messages printed to cout output stream.
StreamMask operator|(const StreamMask &other)
StreamMask()
Empty constructor.
std::string function_
Actual function.
int mpi_rank_
Actual process (if MPI is supported)
Class for storing logger messages.
void print_file_header(std::stringstream &file_stream)
Print header to file stream, helper method called from print_to_file.
Array(Cont const &v, Delim d=", ")
friend std::ostream & operator<<(std::ostream &os, Array const &manip)
StreamMask(int mask)
Constructor set mask_ value.