aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-15 15:22:36 +0200
committerStefan Boberg <[email protected]>2021-09-15 15:22:36 +0200
commitffd45d6a5bd1e95065da71f00b6a9107b805c3ae (patch)
treeee0b16a4220e15ce58332552757781e6c93f9829
parentSwitched some Jupiter logging to not use `_format` - this is handled by the l... (diff)
downloadzen-ffd45d6a5bd1e95065da71f00b6a9107b805c3ae.tar.xz
zen-ffd45d6a5bd1e95065da71f00b6a9107b805c3ae.zip
Made logging macros always append `sv` string_view literal suffix
Fixed up the few instances of explicit string_view arguments to make sure they compile properly with the new macros
-rw-r--r--zencore/include/zencore/logging.h14
-rw-r--r--zencore/logging.cpp4
-rw-r--r--zenhttp/httpsys.cpp22
3 files changed, 21 insertions, 19 deletions
diff --git a/zencore/include/zencore/logging.h b/zencore/include/zencore/logging.h
index eefed4efa..4996463fd 100644
--- a/zencore/include/zencore/logging.h
+++ b/zencore/include/zencore/logging.h
@@ -31,9 +31,11 @@ using zen::Log;
// Helper macros for logging
-#define ZEN_TRACE(...) Log().trace(__VA_ARGS__)
-#define ZEN_DEBUG(...) Log().debug(__VA_ARGS__)
-#define ZEN_INFO(...) Log().info(__VA_ARGS__)
-#define ZEN_WARN(...) Log().warn(__VA_ARGS__)
-#define ZEN_ERROR(...) Log().error(__VA_ARGS__)
-#define ZEN_CRITICAL(...) Log().critical(__VA_ARGS__)
+using namespace std::literals;
+
+#define ZEN_TRACE(fmtstr, ...) Log().trace(fmtstr##sv, __VA_ARGS__)
+#define ZEN_DEBUG(fmtstr, ...) Log().debug(fmtstr##sv, __VA_ARGS__)
+#define ZEN_INFO(fmtstr, ...) Log().info(fmtstr##sv, __VA_ARGS__)
+#define ZEN_WARN(fmtstr, ...) Log().warn(fmtstr##sv, __VA_ARGS__)
+#define ZEN_ERROR(fmtstr, ...) Log().error(fmtstr##sv, __VA_ARGS__)
+#define ZEN_CRITICAL(fmtstr, ...) Log().critical(fmtstr##sv, __VA_ARGS__)
diff --git a/zencore/logging.cpp b/zencore/logging.cpp
index 9d5a726f5..00ec845b4 100644
--- a/zencore/logging.cpp
+++ b/zencore/logging.cpp
@@ -9,7 +9,7 @@ namespace zen {
spdlog::logger&
Log()
{
- return *spdlog::default_logger();
+ return *spdlog::default_logger_raw();
}
} // namespace zen
@@ -19,7 +19,7 @@ namespace zen::logging {
spdlog::logger&
Default()
{
- return *spdlog::default_logger();
+ return *spdlog::default_logger_raw();
}
spdlog::logger&
diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp
index 00869a43b..8ae4fa602 100644
--- a/zenhttp/httpsys.cpp
+++ b/zenhttp/httpsys.cpp
@@ -554,7 +554,7 @@ HttpMessageResponseRequest::IssueRequest(std::error_code& ErrorCode)
CancelThreadpoolIo(Iocp);
- ZEN_ERROR("failed to send HTTP response (error: '{}'), request URL: {}"sv, SendResult, HttpReq->pRawUrl);
+ ZEN_ERROR("failed to send HTTP response (error: '{}'), request URL: {}", SendResult, HttpReq->pRawUrl);
ErrorCode = MakeWin32ErrorCode(SendResult);
}
@@ -605,7 +605,7 @@ HttpSysServer::Initialize(const wchar_t* UrlPath)
if (Result != NO_ERROR)
{
- ZEN_ERROR("Failed to create server session for '{}': {:#x}"sv, WideToUtf8(UrlPath), Result);
+ ZEN_ERROR("Failed to create server session for '{}': {:#x}", WideToUtf8(UrlPath), Result);
return;
}
@@ -614,7 +614,7 @@ HttpSysServer::Initialize(const wchar_t* UrlPath)
if (Result != NO_ERROR)
{
- ZEN_ERROR("Failed to create URL group for '{}': {:#x}"sv, WideToUtf8(UrlPath), Result);
+ ZEN_ERROR("Failed to create URL group for '{}': {:#x}", WideToUtf8(UrlPath), Result);
return;
}
@@ -625,7 +625,7 @@ HttpSysServer::Initialize(const wchar_t* UrlPath)
if (Result != NO_ERROR)
{
- ZEN_ERROR("Failed to add base URL to URL group for '{}': {:#x}"sv, WideToUtf8(UrlPath), Result);
+ ZEN_ERROR("Failed to add base URL to URL group for '{}': {:#x}", WideToUtf8(UrlPath), Result);
return;
}
@@ -640,7 +640,7 @@ HttpSysServer::Initialize(const wchar_t* UrlPath)
if (Result != NO_ERROR)
{
- ZEN_ERROR("Failed to create request queue for '{}': {:#x}"sv, WideToUtf8(UrlPath), Result);
+ ZEN_ERROR("Failed to create request queue for '{}': {:#x}", WideToUtf8(UrlPath), Result);
return;
}
@@ -652,7 +652,7 @@ HttpSysServer::Initialize(const wchar_t* UrlPath)
if (Result != NO_ERROR)
{
- ZEN_ERROR("Failed to set server binding property for '{}': {:#x}"sv, WideToUtf8(UrlPath), Result);
+ ZEN_ERROR("Failed to set server binding property for '{}': {:#x}", WideToUtf8(UrlPath), Result);
return;
}
@@ -664,7 +664,7 @@ HttpSysServer::Initialize(const wchar_t* UrlPath)
if (ErrorCode)
{
- ZEN_ERROR("Failed to create IOCP for '{}': {}"sv, WideToUtf8(UrlPath), ErrorCode.message());
+ ZEN_ERROR("Failed to create IOCP for '{}': {}", WideToUtf8(UrlPath), ErrorCode.message());
}
else
{
@@ -803,7 +803,7 @@ HttpSysServer::RegisterService(const char* UrlPath, HttpService& Service)
if (Result != NO_ERROR)
{
- ZEN_ERROR("HttpAddUrlToUrlGroup failed with result {}"sv, Result);
+ ZEN_ERROR("HttpAddUrlToUrlGroup failed with result {}", Result);
return;
}
@@ -829,7 +829,7 @@ HttpSysServer::UnregisterService(const char* UrlPath, HttpService& Service)
if (Result != NO_ERROR)
{
- ZEN_ERROR("HttpRemoveUrlFromUrlGroup failed with result {}"sv, Result);
+ ZEN_ERROR("HttpRemoveUrlFromUrlGroup failed with result {}", Result);
}
}
@@ -917,7 +917,7 @@ HttpSysTransaction::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesTran
if (ErrorCode)
{
- ZEN_ERROR("IssueRequest() failed {}"sv, ErrorCode.message());
+ ZEN_ERROR("IssueRequest() failed {}", ErrorCode.message());
}
else
{
@@ -926,7 +926,7 @@ HttpSysTransaction::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesTran
}
catch (std::exception& Ex)
{
- ZEN_ERROR("exception caught from IssueRequest(): {}"sv, Ex.what());
+ ZEN_ERROR("exception caught from IssueRequest(): {}", Ex.what());
// something went wrong, no request is pending
}