| Revision: | 1096 | 
| Committed: | Sat Dec 30 14:40:33 2017 UTC (7 years, 10 months ago) by s10k | 
| Content type: | text/x-chdr | 
| File size: | 763 byte(s) | 
| Log Message: | 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) | 
| # | Content | 
|---|---|
| 1 | #pragma once | 
| 2 | #include <plog/Appenders/IAppender.h> | 
| 3 | #include <plog/Util.h> | 
| 4 | #include <iostream> | 
| 5 | |
| 6 | namespace 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 | } |