mirror of https://github.com/AxioDL/logvisor.git
Add global log counter
This commit is contained in:
parent
bb0535f3a9
commit
2e595922be
|
@ -118,6 +118,17 @@ static inline std::unique_lock<std::recursive_mutex> LockLog()
|
|||
return _LogMutex.lock();
|
||||
}
|
||||
|
||||
extern uint64_t _LogCounter;
|
||||
|
||||
/**
|
||||
* @brief Get current count of logging events
|
||||
* @return Log Count
|
||||
*/
|
||||
static inline uint64_t GetLogCounter()
|
||||
{
|
||||
return _LogCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Restore centralized logger vector to default state (silent operation)
|
||||
*/
|
||||
|
@ -192,6 +203,7 @@ public:
|
|||
inline void report(Level severity, const CharType* format, va_list ap)
|
||||
{
|
||||
auto lk = LockLog();
|
||||
++_LogCounter;
|
||||
for (auto& logger : MainLoggers)
|
||||
{
|
||||
va_list apc;
|
||||
|
@ -229,6 +241,7 @@ public:
|
|||
inline void reportSource(Level severity, const char* file, unsigned linenum, const CharType* format, va_list ap)
|
||||
{
|
||||
auto lk = LockLog();
|
||||
++_LogCounter;
|
||||
for (auto& logger : MainLoggers)
|
||||
{
|
||||
va_list apc;
|
||||
|
|
|
@ -278,6 +278,8 @@ static void AbortHandler(int signum)
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t _LogCounter;
|
||||
|
||||
std::vector<std::unique_ptr<ILogger>> MainLoggers;
|
||||
std::atomic_size_t ErrorCount(0);
|
||||
static std::chrono::steady_clock MonoClock;
|
||||
|
|
Loading…
Reference in New Issue