aboutsummaryrefslogtreecommitdiff
path: root/src/utility.h
blob: 27ce8e9b88e95f773697074d6787b8bb9ec07835 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef CHANGE_UTILITY_H_
#define CHANGE_UTILITY_H_

#include <ext/stdio_filebuf.h>

#include <iostream>

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<char> buffer;
		std::ostream                   stream;

};

}

#endif  // CHANGE_UTILITY_H_