2016-11-29 06:03:05 +01:00
|
|
|
|
#ifndef __PLASP__OUTPUT__LOGGER_H
|
|
|
|
|
#define __PLASP__OUTPUT__LOGGER_H
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include <plasp/output/ColorStream.h>
|
|
|
|
|
#include <plasp/output/Priority.h>
|
|
|
|
|
|
2017-05-09 15:05:59 +02:00
|
|
|
|
#include <parsebase/Location.h>
|
|
|
|
|
|
2016-11-29 06:03:05 +01:00
|
|
|
|
namespace plasp
|
|
|
|
|
{
|
|
|
|
|
namespace output
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Logger
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class Logger
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit Logger();
|
|
|
|
|
explicit Logger(ColorStream &&outputStream);
|
|
|
|
|
explicit Logger(ColorStream &&outputStream, ColorStream &&errorStream);
|
|
|
|
|
|
|
|
|
|
ColorStream &outputStream();
|
|
|
|
|
ColorStream &errorStream();
|
|
|
|
|
|
2016-12-01 17:18:58 +01:00
|
|
|
|
// The priority from which on messages should be printed
|
2016-11-29 06:03:05 +01:00
|
|
|
|
void setLogPriority(Priority logPriority);
|
2016-12-01 17:18:58 +01:00
|
|
|
|
// Messages with this priority (or higher) will terminate the program’s execution
|
|
|
|
|
void setAbortPriority(Priority abortPriority);
|
2016-11-29 06:03:05 +01:00
|
|
|
|
void setColorPolicy(ColorStream::ColorPolicy colorPolicy);
|
|
|
|
|
|
|
|
|
|
void log(Priority priority, const char *message);
|
|
|
|
|
void log(Priority priority, const std::string &message);
|
2017-05-09 15:05:59 +02:00
|
|
|
|
void log(Priority priority, const parsebase::Location &location, const char *message);
|
|
|
|
|
void log(Priority priority, const parsebase::Location &location, const std::string &message);
|
2016-11-29 06:03:05 +01:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
ColorStream m_outputStream;
|
|
|
|
|
ColorStream m_errorStream;
|
|
|
|
|
|
|
|
|
|
Priority m_logPriority;
|
2016-12-01 17:18:58 +01:00
|
|
|
|
Priority m_abortPriority;
|
2016-11-29 06:03:05 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|