2 #ifndef GRAMODS_CORE_MESSAGESINK
3 #define GRAMODS_CORE_MESSAGESINK
5 #include <gmCore/config.hh>
7 #include <gmCore/ConsoleLevel.hh>
8 #include <gmCore/Object.hh>
9 #include <gmCore/OFactory.hh>
14 BEGIN_NAMESPACE_GMCORE;
29 typedef std::chrono::steady_clock clock;
31 Message(ConsoleLevel level, std::string tag, std::string msg,
32 std::string file,
int line, std::string
function)
33 : level(level), tag(tag), message(msg),
34 source_data_available(
true), file(file), line(line),
function(
function),
35 time_stamp(clock::now()) {}
37 Message(ConsoleLevel level, std::string tag, std::string msg)
38 : level(level), tag(tag), message(msg),
39 source_data_available(
false), file(
""), line(0),
function(
""),
40 time_stamp(clock::now()) {}
42 clock::duration getDuration() {
43 static clock::time_point start_time = clock::now();
44 return time_stamp - start_time;
52 bool source_data_available;
57 clock::time_point time_stamp;
64 virtual void initialize()
override;
91 void outputMetadata(std::ostream &out,
Message msg);
95 bool show_time =
false;
This is the base type for back-ends taking care of information sent to the Console class.
Definition: MessageSink.hh:23
virtual void output(Message msg)=0
Outputs the provided message to the implementation specific channel.
void setShowTime(bool on)
Activate or deactivate the output of the time of each message.
Definition: MessageSink.hh:72
Base type for objects in the Gramods package for standardized handling of construction,...
Definition: Object.hh:42
Definition: MessageSink.hh:27