Add KGE_LOG_STREAM & KGE_ERROR_STREAM

This commit is contained in:
Nomango 2020-05-17 20:15:58 +08:00
parent 53cb3659c0
commit a2e3a1ea8c
2 changed files with 11 additions and 4 deletions

View File

@ -298,7 +298,7 @@ void Logger::ResetStreamToStdStream()
} }
// replace the C++ global locale with the user-preferred locale // replace the C++ global locale with the user-preferred locale
(void)std::locale::global(std::locale("")); (void)std::locale::global(std::locale());
(void)std::cout.imbue(std::locale()); (void)std::cout.imbue(std::locale());
(void)std::cerr.imbue(std::locale()); (void)std::cerr.imbue(std::locale());

View File

@ -19,10 +19,9 @@
// THE SOFTWARE. // THE SOFTWARE.
#pragma once #pragma once
#include <iomanip>
#include <kiwano/core/Common.h> #include <kiwano/core/Common.h>
#include <kiwano/macros.h> #include <iomanip>
#include <sstream> #include <streambuf>
#ifndef KGE_SYS_LOG #ifndef KGE_SYS_LOG
#ifdef KGE_DEBUG #ifdef KGE_DEBUG
@ -49,6 +48,14 @@
#define KGE_LOGF(FORMAT, ...) ::kiwano::Logger::GetInstance().Printf(::kiwano::Logger::Level::Info, FORMAT, __VA_ARGS__) #define KGE_LOGF(FORMAT, ...) ::kiwano::Logger::GetInstance().Printf(::kiwano::Logger::Level::Info, FORMAT, __VA_ARGS__)
#endif #endif
#ifndef KGE_LOG_STREAM
#define KGE_LOG_STREAM() ::kiwano::Logger::GetInstance().GetOutputStream()
#endif
#ifndef KGE_ERROR_STREAM
#define KGE_ERROR_STREAM() ::kiwano::Logger::GetInstance().GetErrorStream()
#endif
namespace kiwano namespace kiwano
{ {
/** /**