UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
MessageLogger.h
1 /***************************************************************************
2  * Copyright (C) 2015 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef MESSAGELOGGER_H_
21 #define MESSAGELOGGER_H_
22 
23 #include <ostream>
24 #include "../basic_types/globals.h"
25 #include "../basic_types/standard_operators.h"
26 
27 namespace uncover {
28  namespace logging {
29 
37  class MessageLogger {
38 
39  public:
40 
44  MessageLogger(std::ostream& ostr);
45 
49  virtual ~MessageLogger();
50 
58  std::ostream& newMsg(LogTypes logType);
59 
65  std::ostream& contMsg();
66 
73  std::ostream& newUserInfo();
74 
81  std::ostream& newDebug();
82 
89  std::ostream& newWarning();
90 
97  std::ostream& newError();
98 
105  std::ostream& newCriticalError();
106 
110  void endMsg();
111 
112  private:
113 
118  void streamCurrentTime(std::ostream& ost);
119 
126  std::ostream& streamHeader(std::ostream& ost, LogTypes logType);
127 
131  std::ostream devnull;
132 
136  std::ostream& mainstream;
137 
142 
147 
148  };
149 
150  } /* namespace logging */
151 } /* namespace uncover */
152 
153 #endif /* MESSAGELOGGER_H_ */
std::ostream & contMsg()
Return the output stream for the currently streamed log message.
Definition: MessageLogger.cpp:50
void streamCurrentTime(std::ostream &ost)
Streams the current time stamp in the format 'day.month.year hour:minute:second'. ...
Definition: MessageLogger.cpp:89
LogTypes
LogTypes defines all types of log-messages usable with a messageLogger stream.
Definition: globals.h:65
std::ostream devnull
This output stream discards all information sent to it.
Definition: MessageLogger.h:131
bool messageStreaming
Stores whether there is a message currently streamed.
Definition: MessageLogger.h:146
virtual ~MessageLogger()
Destroys the current MessageLogger instance.
Definition: MessageLogger.cpp:34
std::ostream & newError()
Creates a new log message for errors.
Definition: MessageLogger.cpp:73
std::ostream & newMsg(LogTypes logType)
Creates a new log message of the given type.
Definition: MessageLogger.cpp:36
std::ostream & newWarning()
Creates a new log message for warnings.
Definition: MessageLogger.cpp:69
std::ostream & newDebug()
Creates a new log message for debug information.
Definition: MessageLogger.cpp:65
std::ostream & mainstream
Stores the output stream given this MessageLogger while instantiation.
Definition: MessageLogger.h:136
std::ostream & newUserInfo()
Creates a new log message for user information.
Definition: MessageLogger.cpp:61
MessageLogger(std::ostream &ostr)
Creates a new MessageLogger which will use the given output stream to stream messages.
Definition: MessageLogger.cpp:29
void endMsg()
Ends the currently stream message.
Definition: MessageLogger.cpp:81
LogTypes currLevel
Stores the log level of the message currently streamed.
Definition: MessageLogger.h:141
This class is used to stream log messages.
Definition: MessageLogger.h:37
std::ostream & newCriticalError()
Creates a new log message for critical errors.
Definition: MessageLogger.cpp:77
std::ostream & streamHeader(std::ostream &ost, LogTypes logType)
Streams a header for a log message of the given type to the given stream.
Definition: MessageLogger.cpp:98