41 std::ostream* _log_stream;
49 LogStream(
const std::string &prefix, std::ostream& log_stream)
50 : _prefix(prefix), _new_line(true) {
51 _log_stream = &log_stream;
61 (*_log_stream) <<
"[ " << _prefix <<
" ] ";
65 (*_log_stream) << arg;
73 (*_log_stream) << std::endl;
79 (*_log_stream) << std::boolalpha;
84 template<
template<
class,
class>
class Container,
class T>
86 for (
const auto& el : container) {
87 *
this << el << slog::endl;
94 static LogStream info(
"INFO", std::cout);
95 static LogStream debug(
"DEBUG", std::cout);
96 static LogStream warn(
"WARNING", std::cout);
97 static LogStream err(
"ERROR", std::cerr);
The LogStreamBoolAlpha class implements bool printing for a log stream.
Definition: slog.hpp:30
The LogStreamEndLine class implements an end line marker for a log stream.
Definition: slog.hpp:21
The LogStream class implements a stream for sample logging.
Definition: slog.hpp:39
LogStream & operator<<(const T &arg)
A stream output operator to be used within the logger.
Definition: slog.hpp:59
LogStream(const std::string &prefix, std::ostream &log_stream)
A constructor. Creates a LogStream object.
Definition: slog.hpp:49