aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/httpsys.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-26 22:09:13 +0200
committerStefan Boberg <[email protected]>2021-09-26 22:09:13 +0200
commitd84260d180be72b547d04351c91a02e7c75f2b51 (patch)
tree72bb2fd809fe2ae7d7413995db8e7540ead034a2 /zenhttp/httpsys.cpp
parentReimplemented CasLogFile in terms of BasicFile (diff)
downloadzen-d84260d180be72b547d04351c91a02e7c75f2b51.tar.xz
zen-d84260d180be72b547d04351c91a02e7c75f2b51.zip
httpsys: Some logging improvements
Diffstat (limited to 'zenhttp/httpsys.cpp')
-rw-r--r--zenhttp/httpsys.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp
index 9c747d17e..2a50388e3 100644
--- a/zenhttp/httpsys.cpp
+++ b/zenhttp/httpsys.cpp
@@ -575,7 +575,10 @@ HttpMessageResponseRequest::IssueRequest(std::error_code& ErrorCode)
\/ \/ \/
*/
-HttpSysServer::HttpSysServer(unsigned int ThreadCount) : m_ThreadPool(ThreadCount)
+HttpSysServer::HttpSysServer(unsigned int ThreadCount)
+: m_Log(logging::Get("http"))
+, m_RequestLog(logging::Get("http_requests"))
+, m_ThreadPool(ThreadCount)
{
ULONG Result = HttpInitialize(HTTPAPI_VERSION_2, HTTP_INITIALIZE_SERVER, nullptr);
@@ -671,6 +674,8 @@ HttpSysServer::Initialize(const wchar_t* UrlPath)
else
{
m_IsOk = true;
+
+ ZEN_INFO("Started http.sys server at '{}'", WideToUtf8(UrlPath));
}
}
@@ -950,6 +955,14 @@ HttpSysTransaction::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesTran
return Status::kRequestPending;
}
+ if (m_HttpServer.m_IsRequestLoggingEnabled)
+ {
+ if (m_HandlerRequest.has_value())
+ {
+ m_HttpServer.m_RequestLog.info("{} {}", ToString(m_HandlerRequest->RequestVerb()), m_HandlerRequest->RelativeUri());
+ }
+ }
+
// Transaction done, caller should clean up (delete) this instance
return Status::kDone;
}