From ceb01fb33a039d4f315c9aa9217320be44cefa2d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 18 Oct 2015 17:19:55 +0200 Subject: Move io and logging functionality into separate namespaces --- utility.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 utility.h (limited to 'utility.h') diff --git a/utility.h b/utility.h new file mode 100644 index 0000000..ec4529e --- /dev/null +++ b/utility.h @@ -0,0 +1,27 @@ +#ifndef CHANGE_UTILITY_H_ +#define CHANGE_UTILITY_H_ + +#include + +#include + +namespace utility { + +class Logger { + public: + Logger(const int target_fd): + buffer(target_fd, std::ios::out), + stream(&this->buffer) { } + + void append(const std::string& msg) { + this->stream << msg << std::endl; + } + + private: + __gnu_cxx::stdio_filebuf buffer; + std::ostream stream; +}; + +} + +#endif // CHANGE_UTILITY_H_ -- cgit v1.2.3