You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.5 KiB
C

2 years ago
#pragma once
#include "fmt/format.h"
2 years ago
#include "DllDefines.h"
#ifdef LEGACY_LOGGER
#include "LegacyDebugLog.h"
#include "LegacyDebugLogTiming.h"
#include "LegacyGuiEventLog.h"
extern UTILITYDLL CLegacyDebugLog mitechDebug;
extern UTILITYDLL CLegacyDebugLogTiming mitechDebugLogTiming;
extern UTILITYDLL CLegacyGuiEventLog mitechGuiEventLog;
#else
2 years ago
#include "spdlog/spdlog.h"
#include "LogManager.h"
using namespace mitech::utils::logging;
#endif
//
2 years ago
template <typename... Args>
void TraceLog(fmt::format_string<Args...> _fmt, Args&&... args)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::DEBUG_LOG).Trace(_fmt, args...);
2 years ago
}
template <typename... Args>
void InfoLog(fmt::format_string<Args...> _fmt, Args&&... args)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::DEBUG_LOG).Info(_fmt, args...);
2 years ago
}
template <typename... Args>
void DebugLog(fmt::format_string<Args...> _fmt, Args&&... args)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::DEBUG_LOG).Log(_fmt, args...);
}
2 years ago
template <typename... Args>
void DebugLogTrace(bool bTraceData, fmt::format_string<Args...> _fmt, Args&&... args)
{
if (bTraceData)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::DEBUG_LOG).Log(_fmt, args...);
2 years ago
}
}
template <typename... Args>
void DebugLogError(bool bTraceData, fmt::format_string<Args...> _fmt, Args&&... args)
{
if (bTraceData)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::DEBUG_LOG).Error(_fmt, args...);
}
}
template <typename... Args>
void DebugLogTiming(fmt::format_string<Args...> _fmt, Args&&... args)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::DEBUG_TIMING_LOG).Log(_fmt, args...);
}
template <typename... Args>
void DebugLogTimingTrace(bool bTraceData, fmt::format_string<Args...> _fmt, Args&&... args)
{
if (bTraceData)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::DEBUG_TIMING_LOG).Log(_fmt, args...);
}
}
template <typename... Args>
void GUIEventLog(fmt::format_string<Args...> _fmt, Args&&... args)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::GUI_EVENT_LOG).Log(_fmt, args...);
}
template <typename... Args>
void SGDebugLog(fmt::format_string<Args...> _fmt, Args&&... args)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::SG_DEBUG_LOG).Log(_fmt, args...);
}
template <typename... Args>
void SGDebugLogError(fmt::format_string<Args...> _fmt, Args&&... args)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::SG_DEBUG_LOG).Error(_fmt, args...);
}
template <typename... Args>
void SGDebugLogInfo(fmt::format_string<Args...> _fmt, Args&&... args)
{
CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::SG_DEBUG_LOG).Info(_fmt, args...);
}
2 years ago
std::shared_ptr<spdlog::logger> UTILITYDLL GetLogger(const std::string& strName);
// on demand flush to file
void UTILITYDLL FlushDebugLog();
void UTILITYDLL FlushDebugLogTiming();
void UTILITYDLL FlushGuiEventLog();
void UTILITYDLL FlushSGDebugLog();
//
void UTILITYDLL ShutdownLogging();
2 years ago
void UTILITYDLL StartDebugLog();
void UTILITYDLL StopDebugLog();
void UTILITYDLL StartDebugTimingLog();
void UTILITYDLL StopDebugTimingLog();
bool UTILITYDLL IsDebugLogStarted();
bool UTILITYDLL IsDebugLogTimingStarted();
// All GUI Activities Events Log
void UTILITYDLL StartGUIEventLog();
void UTILITYDLL StopGUIEventLog();
void UTILITYDLL StartSGDebugLog();
void UTILITYDLL StopSGDebugLog();