Added Logger constructors to write output to arbitrary streams.

This commit is contained in:
Patrick Lühne 2016-11-24 13:54:40 +01:00
parent 8a587eb57a
commit eff3b45089
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 19 additions and 3 deletions

View File

@ -21,7 +21,9 @@ namespace output
class Logger
{
public:
Logger();
explicit Logger();
explicit Logger(ColorStream &&outputStream);
explicit Logger(ColorStream &&outputStream, ColorStream &&errorStream);
ColorStream &outputStream();
ColorStream &errorStream();

View File

@ -60,8 +60,22 @@ constexpr const Format LocationFormat = {Color::White, FontWeight::Bold};
////////////////////////////////////////////////////////////////////////////////////////////////////
Logger::Logger()
: m_outputStream{std::cout},
m_errorStream{std::cerr},
: Logger(std::cout, std::cerr)
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////
Logger::Logger(ColorStream &&outputStream)
: Logger(std::forward<ColorStream &&>(outputStream), std::cerr)
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////
Logger::Logger(ColorStream &&outputStream, ColorStream &&errorStream)
: m_outputStream{outputStream},
m_errorStream{errorStream},
m_outputPriority{Priority::Warning}
{
}