mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Common: Unify logging namespace with Common
Previously the logging was a in a little bit of a disarray. Some things were in namespaces, and other things were not. Given this code will feature a bit of restructuring during the transition over to fmt, this is a good time to unify it under a single namespace and also remove functions and types from the global namespace. Now, all functions and types are under the Common::Log namespace. The only outliers being, of course, the preprocessor macros.
This commit is contained in:
@ -10,12 +10,14 @@
|
||||
#include "Common/BitSet.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
namespace Common::Log
|
||||
{
|
||||
// pure virtual interface
|
||||
class LogListener
|
||||
{
|
||||
public:
|
||||
virtual ~LogListener() {}
|
||||
virtual void Log(LogTypes::LOG_LEVELS, const char* msg) = 0;
|
||||
virtual ~LogListener() = default;
|
||||
virtual void Log(LOG_LEVELS level, const char* msg) = 0;
|
||||
|
||||
enum LISTENER
|
||||
{
|
||||
@ -34,19 +36,19 @@ public:
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
|
||||
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line,
|
||||
const char* fmt, va_list args);
|
||||
void LogWithFullPath(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file,
|
||||
int line, const char* fmt, va_list args);
|
||||
void Log(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, const char* fmt,
|
||||
va_list args);
|
||||
void LogWithFullPath(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, const char* fmt,
|
||||
va_list args);
|
||||
|
||||
LogTypes::LOG_LEVELS GetLogLevel() const;
|
||||
void SetLogLevel(LogTypes::LOG_LEVELS level);
|
||||
LOG_LEVELS GetLogLevel() const;
|
||||
void SetLogLevel(LOG_LEVELS level);
|
||||
|
||||
void SetEnable(LogTypes::LOG_TYPE type, bool enable);
|
||||
bool IsEnabled(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level = LogTypes::LNOTICE) const;
|
||||
void SetEnable(LOG_TYPE type, bool enable);
|
||||
bool IsEnabled(LOG_TYPE type, LOG_LEVELS level = LNOTICE) const;
|
||||
|
||||
const char* GetShortName(LogTypes::LOG_TYPE type) const;
|
||||
const char* GetFullName(LogTypes::LOG_TYPE type) const;
|
||||
const char* GetShortName(LOG_TYPE type) const;
|
||||
const char* GetFullName(LOG_TYPE type) const;
|
||||
|
||||
void RegisterListener(LogListener::LISTENER id, LogListener* listener);
|
||||
void EnableListener(LogListener::LISTENER id, bool enable);
|
||||
@ -70,9 +72,10 @@ private:
|
||||
LogManager(LogManager&&) = delete;
|
||||
LogManager& operator=(LogManager&&) = delete;
|
||||
|
||||
LogTypes::LOG_LEVELS m_level;
|
||||
std::array<LogContainer, LogTypes::NUMBER_OF_LOGS> m_log{};
|
||||
LOG_LEVELS m_level;
|
||||
std::array<LogContainer, NUMBER_OF_LOGS> m_log{};
|
||||
std::array<LogListener*, LogListener::NUMBER_OF_LISTENERS> m_listeners{};
|
||||
BitSet32 m_listener_ids;
|
||||
size_t m_path_cutoff_point = 0;
|
||||
};
|
||||
} // namespace Common::Log
|
||||
|
Reference in New Issue
Block a user