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.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/zencore/logging.cpp b/src/zencore/logging.cpp
index 5ada0cac7..ca34b7d0e 100644
--- a/src/zencore/logging.cpp
+++ b/src/zencore/logging.cpp
@@ -112,6 +112,14 @@ constinit std::string_view LevelNames[] = {std::string_view("trace", 5),
std::string_view("critical", 8),
std::string_view("off", 3)};
+constinit std::string_view ShortNames[] = {std::string_view("trc", 3),
+ std::string_view("dbg", 3),
+ std::string_view("inf", 3),
+ std::string_view("wrn", 3),
+ std::string_view("err", 3),
+ std::string_view("crt", 3),
+ std::string_view("off", 3)};
+
LogLevel
ParseLogLevelString(std::string_view Name)
{
@@ -139,12 +147,27 @@ ParseLogLevelString(std::string_view Name)
std::string_view
ToStringView(LogLevel Level)
{
+ using namespace std::literals;
+
if (int(Level) < LogLevelCount)
{
return LevelNames[int(Level)];
}
- return "None";
+ return "None"sv;
+}
+
+std::string_view
+ShortToStringView(LogLevel Level)
+{
+ using namespace std::literals;
+
+ if (int(Level) < LogLevelCount)
+ {
+ return ShortNames[int(Level)];
+ }
+
+ return "None"sv;
}
} // namespace zen::logging
@@ -476,6 +499,10 @@ LoggerRef::LoggerRef(logging::Logger& InLogger) : m_Logger(static_cast<logging::
{
}
+LoggerRef::LoggerRef(std::string_view LogCategory) : m_Logger(zen::logging::Get(LogCategory).m_Logger)
+{
+}
+
void
LoggerRef::Flush()
{