55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#ifndef __PLASP__OUTPUT__LOGGER_H
|
|
#define __PLASP__OUTPUT__LOGGER_H
|
|
|
|
#include <string>
|
|
|
|
#include <plasp/input/Location.h>
|
|
#include <plasp/output/ColorStream.h>
|
|
#include <plasp/output/Priority.h>
|
|
|
|
namespace plasp
|
|
{
|
|
namespace output
|
|
{
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Logger
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
class Logger
|
|
{
|
|
public:
|
|
explicit Logger();
|
|
explicit Logger(ColorStream &&outputStream);
|
|
explicit Logger(ColorStream &&outputStream, ColorStream &&errorStream);
|
|
Logger(Logger &&other);
|
|
Logger &operator=(Logger &&other);
|
|
|
|
ColorStream &outputStream();
|
|
ColorStream &errorStream();
|
|
|
|
// The level from which on messages should be printed
|
|
void setLogPriority(Priority logPriority);
|
|
void setColorPolicy(ColorStream::ColorPolicy colorPolicy);
|
|
|
|
void log(Priority priority, const char *message);
|
|
void log(Priority priority, const std::string &message);
|
|
void log(Priority priority, const input::Location &location, const char *message);
|
|
void log(Priority priority, const input::Location &location, const std::string &message);
|
|
|
|
private:
|
|
ColorStream m_outputStream;
|
|
ColorStream m_errorStream;
|
|
|
|
Priority m_logPriority;
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|