aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/logging.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/logging.cpp')
-rw-r--r--src/zencore/logging.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/zencore/logging.cpp b/src/zencore/logging.cpp
index 1a0a91b3d..7bd500b3b 100644
--- a/src/zencore/logging.cpp
+++ b/src/zencore/logging.cpp
@@ -6,6 +6,8 @@
#include <zencore/testing.h>
#include <zencore/thread.h>
+#include <zencore/memory/llm.h>
+
ZEN_THIRD_PARTY_INCLUDES_START
#include <spdlog/details/registry.h>
#include <spdlog/sinks/null_sink.h>
@@ -66,6 +68,7 @@ static_assert(offsetof(spdlog::source_loc, funcname) == offsetof(SourceLocation,
void
EmitLogMessage(LoggerRef& Logger, int LogLevel, const std::string_view Message)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
const spdlog::level::level_enum InLevel = (spdlog::level::level_enum)LogLevel;
Logger.SpdLogger->log(InLevel, Message);
if (IsErrorLevel(LogLevel))
@@ -80,6 +83,7 @@ EmitLogMessage(LoggerRef& Logger, int LogLevel, const std::string_view Message)
void
EmitLogMessage(LoggerRef& Logger, int LogLevel, std::string_view Format, fmt::format_args Args)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
zen::logging::LoggingContext LogCtx;
fmt::vformat_to(fmt::appender(LogCtx.MessageBuffer), Format, Args);
zen::logging::EmitLogMessage(Logger, LogLevel, LogCtx.Message());
@@ -88,6 +92,7 @@ EmitLogMessage(LoggerRef& Logger, int LogLevel, std::string_view Format, fmt::fo
void
EmitLogMessage(LoggerRef& Logger, const SourceLocation& InLocation, int LogLevel, const std::string_view Message)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
const spdlog::source_loc& Location = *reinterpret_cast<const spdlog::source_loc*>(&InLocation);
const spdlog::level::level_enum InLevel = (spdlog::level::level_enum)LogLevel;
Logger.SpdLogger->log(Location, InLevel, Message);
@@ -103,6 +108,7 @@ EmitLogMessage(LoggerRef& Logger, const SourceLocation& InLocation, int LogLevel
void
EmitLogMessage(LoggerRef& Logger, const SourceLocation& InLocation, int LogLevel, std::string_view Format, fmt::format_args Args)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
zen::logging::LoggingContext LogCtx;
fmt::vformat_to(fmt::appender(LogCtx.MessageBuffer), Format, Args);
zen::logging::EmitLogMessage(Logger, InLocation, LogLevel, LogCtx.Message());
@@ -111,6 +117,7 @@ EmitLogMessage(LoggerRef& Logger, const SourceLocation& InLocation, int LogLevel
void
EmitConsoleLogMessage(int LogLevel, const std::string_view Message)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
const spdlog::level::level_enum InLevel = (spdlog::level::level_enum)LogLevel;
ConsoleLog().SpdLogger->log(InLevel, Message);
}
@@ -118,6 +125,7 @@ EmitConsoleLogMessage(int LogLevel, const std::string_view Message)
void
EmitConsoleLogMessage(int LogLevel, std::string_view Format, fmt::format_args Args)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
zen::logging::LoggingContext LogCtx;
fmt::vformat_to(fmt::appender(LogCtx.MessageBuffer), Format, Args);
zen::logging::EmitConsoleLogMessage(LogLevel, LogCtx.Message());
@@ -192,6 +200,8 @@ std::string LogLevels[level::LogLevelCount];
void
ConfigureLogLevels(level::LogLevel Level, std::string_view Loggers)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
+
RwLock::ExclusiveLockScope _(LogLevelsLock);
LogLevels[Level] = Loggers;
}
@@ -199,6 +209,8 @@ ConfigureLogLevels(level::LogLevel Level, std::string_view Loggers)
void
RefreshLogLevels(level::LogLevel* DefaultLevel)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
+
spdlog::details::registry::log_levels Levels;
{
@@ -275,6 +287,8 @@ Default()
void
SetDefault(std::string_view NewDefaultLoggerId)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
+
auto NewDefaultLogger = spdlog::get(std::string(NewDefaultLoggerId));
ZEN_ASSERT(NewDefaultLogger);
@@ -293,6 +307,8 @@ ErrorLog()
void
SetErrorLog(std::string_view NewErrorLoggerId)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
+
if (NewErrorLoggerId.empty())
{
TheErrorLogger = {};
@@ -310,6 +326,8 @@ SetErrorLog(std::string_view NewErrorLoggerId)
LoggerRef
Get(std::string_view Name)
{
+ UE_MEMSCOPE(ELLMTag::Logging);
+
std::shared_ptr<spdlog::logger> Logger = spdlog::get(std::string(Name));
if (!Logger)
@@ -339,6 +357,8 @@ SuppressConsoleLog()
LoggerRef
ConsoleLog()
{
+ UE_MEMSCOPE(ELLMTag::Logging);
+
std::call_once(ConsoleInitFlag, [&] {
if (!ConLogger)
{
@@ -355,6 +375,8 @@ ConsoleLog()
void
InitializeLogging()
{
+ UE_MEMSCOPE(ELLMTag::Logging);
+
TheDefaultLogger = *spdlog::default_logger_raw();
}