forked from organicmaps/organicmaps
Global logging level now uses atomic to avoid multithreading issues.
This commit is contained in:
parent
9adc5bbcc3
commit
cfae9d4ba4
2 changed files with 10 additions and 6 deletions
|
@ -92,10 +92,10 @@ namespace my
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
LogLevel g_LogLevel = LDEBUG;
|
||||
LogLevel g_LogAbortLevel = LERROR;
|
||||
TLogLevel g_LogLevel = {LDEBUG};
|
||||
TLogLevel g_LogAbortLevel = {LERROR};
|
||||
#else
|
||||
LogLevel g_LogLevel = LINFO;
|
||||
LogLevel g_LogAbortLevel = LCRITICAL;
|
||||
TLogLevel g_LogLevel = {LINFO};
|
||||
TLogLevel g_LogAbortLevel = {LCRITICAL};
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "base/base.hpp"
|
||||
#include "base/internal/message.hpp"
|
||||
#include "base/src_point.hpp"
|
||||
|
||||
#include "std/atomic.hpp"
|
||||
|
||||
namespace my
|
||||
{
|
||||
enum LogLevel
|
||||
|
@ -14,11 +17,12 @@ namespace my
|
|||
LCRITICAL
|
||||
};
|
||||
|
||||
typedef atomic<LogLevel> TLogLevel;
|
||||
typedef void (*LogMessageFn)(LogLevel level, SrcPoint const &, string const &);
|
||||
|
||||
extern LogMessageFn LogMessage;
|
||||
extern LogLevel g_LogLevel;
|
||||
extern LogLevel g_LogAbortLevel;
|
||||
extern TLogLevel g_LogLevel;
|
||||
extern TLogLevel g_LogAbortLevel;
|
||||
|
||||
/// @return Pointer to previous message function.
|
||||
LogMessageFn SetLogMessageFn(LogMessageFn fn);
|
||||
|
|
Loading…
Add table
Reference in a new issue