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

Last change on this file since 1165 was 1096, checked in by s10k, 7 years ago

Added zlib, quazip, basicxmlsyntaxhighlighter, conditionalsemaphore and linenumberdisplay libraries. zlib and quazip are pre-compiled, but you can compile them yourself, just delete the dll files (or equivalent binary files to your OS)

File size: 763 bytes
Line 
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.