source: s10k/CommonLibs/plog/Appenders/ConsoleAppender.h@ 1077

Last change on this file since 1077 was 1073, checked in by s10k, 7 years ago

added XML Tools latest version (2.0d) and s10k's common libs

File size: 803 bytes
RevLine 
[1073]1#pragma once
2#include <plog/Appenders/IAppender.h>
3#include <plog/Util.h>
4#include <iostream>
5
6namespace plog
7{
8 template<class Formatter>
9 class ConsoleAppender : public IAppender
10 {
11 public:
12 ConsoleAppender()
13 {
14#ifdef _WIN32
15 ::setlocale(LC_ALL, "");
16#endif
17 }
18
19 virtual void write(const Record& record)
20 {
21 util::nstring str = Formatter::format(record);
22 util::MutexLock lock(m_mutex);
23
24 writestr(str);
25 }
26
27 protected:
28 void writestr(const util::nstring& str)
29 {
30#ifdef _WIN32
31 std::wcout << str << std::flush;
32#else
33 std::cout << str << std::flush;
34#endif
35 }
36
37 protected:
38 util::Mutex m_mutex;
39 };
40}
Note: See TracBrowser for help on using the repository browser.