debug: use source_location for native logger

This commit is contained in:
2026-04-05 03:34:25 +08:00
parent 6a5c23dce2
commit e23f469e5a
3 changed files with 77 additions and 21 deletions

View File

@@ -6,8 +6,9 @@
#include <XCEngine/Core/Containers/String.h>
#include "../Threading/Mutex.h"
#include <vector>
#include <memory>
#include <source_location>
#include <vector>
namespace XCEngine {
namespace Debug {
@@ -23,15 +24,36 @@ public:
void RemoveSink(ILogSink* sink);
void Log(LogLevel level, LogCategory category,
const Containers::String& message, const char* file = nullptr,
const Containers::String& message,
const std::source_location& location = std::source_location::current());
void Log(LogLevel level, LogCategory category,
const Containers::String& message, const char* file,
int32_t line = 0, const char* function = nullptr);
void Verbose(LogCategory category, const Containers::String& message);
void Debug(LogCategory category, const Containers::String& message);
void Info(LogCategory category, const Containers::String& message);
void Warning(LogCategory category, const Containers::String& message);
void Error(LogCategory category, const Containers::String& message);
void Fatal(LogCategory category, const Containers::String& message);
void Verbose(
LogCategory category,
const Containers::String& message,
const std::source_location& location = std::source_location::current());
void Debug(
LogCategory category,
const Containers::String& message,
const std::source_location& location = std::source_location::current());
void Info(
LogCategory category,
const Containers::String& message,
const std::source_location& location = std::source_location::current());
void Warning(
LogCategory category,
const Containers::String& message,
const std::source_location& location = std::source_location::current());
void Error(
LogCategory category,
const Containers::String& message,
const std::source_location& location = std::source_location::current());
void Fatal(
LogCategory category,
const Containers::String& message,
const std::source_location& location = std::source_location::current());
void SetMinimumLevel(LogLevel level);
void SetCategoryEnabled(LogCategory category, bool enabled);
@@ -48,7 +70,7 @@ private:
};
#define XE_LOG(category, level, message) \
XCEngine::Debug::Logger::Get().Log(level, category, message, __FILE__, __LINE__, __FUNCTION__)
XCEngine::Debug::Logger::Get().Log(level, category, message)
#define XE_ASSERT(condition, message) \
if (!(condition)) { \