aboutsummaryrefslogtreecommitdiff
path: root/zenserver/testing
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-15 13:18:34 +0200
committerStefan Boberg <[email protected]>2021-09-15 13:18:34 +0200
commitab95978c10258cab130ef7e6dc3f7cb7a1bf337d (patch)
treea6e4ca55890f5b728f69ccf8878af98ba2e31bc9 /zenserver/testing
parentAdded #ifdef condition around Windows-specific exception handling (diff)
parentCross-platform zen::GetLastError() (diff)
downloadzen-ab95978c10258cab130ef7e6dc3f7cb7a1bf337d.tar.xz
zen-ab95978c10258cab130ef7e6dc3f7cb7a1bf337d.zip
Merged from main
Diffstat (limited to 'zenserver/testing')
-rw-r--r--zenserver/testing/httptest.h3
-rw-r--r--zenserver/testing/launch.cpp27
-rw-r--r--zenserver/testing/launch.h6
3 files changed, 19 insertions, 17 deletions
diff --git a/zenserver/testing/httptest.h b/zenserver/testing/httptest.h
index 5809d4e2e..b445fb450 100644
--- a/zenserver/testing/httptest.h
+++ b/zenserver/testing/httptest.h
@@ -2,10 +2,9 @@
#pragma once
+#include <zencore/logging.h>
#include <zenhttp/httpserver.h>
-#include <spdlog/spdlog.h>
-
namespace zen {
/**
diff --git a/zenserver/testing/launch.cpp b/zenserver/testing/launch.cpp
index b031193d5..608b515e1 100644
--- a/zenserver/testing/launch.cpp
+++ b/zenserver/testing/launch.cpp
@@ -8,6 +8,7 @@
#include <zencore/fmtutils.h>
#include <zencore/iobuffer.h>
#include <zencore/iohash.h>
+#include <zencore/logging.h>
#include <zencore/windows.h>
#include <zenstore/CAS.h>
@@ -79,7 +80,7 @@ BasicJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine)
m_ProcessHandle.Attach(ProcessInfo.hProcess);
::CloseHandle(ProcessInfo.hThread);
- spdlog::info("Created process {}", m_ProcessId);
+ ZEN_INFO("Created process {}", m_ProcessId);
return true;
}
@@ -115,12 +116,12 @@ BasicJob::ExitCode()
if (!Success)
{
- spdlog::warn("failed getting exit code");
+ ZEN_WARN("failed getting exit code");
}
if (Ec == STILL_ACTIVE)
{
- spdlog::warn("getting exit code but process is STILL_ACTIVE");
+ ZEN_WARN("getting exit code but process is STILL_ACTIVE");
}
return gsl::narrow_cast<int>(Ec);
@@ -221,7 +222,7 @@ SandboxedJob::Initialize(std::string_view AppContainerId)
if (FAILED(hRes))
{
- spdlog::error("Failed creating app container SID");
+ ZEN_ERROR("Failed creating app container SID");
}
}
@@ -230,12 +231,12 @@ SandboxedJob::Initialize(std::string_view AppContainerId)
PWSTR Str = nullptr;
::ConvertSidToStringSid(m_AppContainerSid, &Str);
- spdlog::info("AppContainer SID : '{}'", WideToUtf8(Str));
+ ZEN_INFO("AppContainer SID : '{}'", WideToUtf8(Str));
PWSTR Path = nullptr;
if (SUCCEEDED(::GetAppContainerFolderPath(Str, &Path)))
{
- spdlog::info("AppContainer folder: '{}'", WideToUtf8(Path));
+ ZEN_INFO("AppContainer folder: '{}'", WideToUtf8(Path));
::CoTaskMemFree(Path);
}
@@ -311,13 +312,13 @@ SandboxedJob::SpawnJob(std::filesystem::path ExePath)
return false;
}
- spdlog::info("Created process {}", ProcessInfo.dwProcessId);
+ ZEN_INFO("Created process {}", ProcessInfo.dwProcessId);
return true;
}
HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::path& SandboxBaseDir)
-: m_Log("exec", begin(spdlog::default_logger()->sinks()), end(spdlog::default_logger()->sinks()))
+: m_Log(logging::Get("exec"))
, m_CasStore(Store)
, m_SandboxPath(SandboxBaseDir)
{
@@ -392,7 +393,7 @@ HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::pat
if (!m_CasStore.FindChunk(FileHash))
{
- spdlog::debug("NEED: {} {} {}", FileHash, Ob["file"sv].AsString(), Ob["size"sv].AsUInt64());
+ ZEN_DEBUG("NEED: {} {} {}", FileHash, Ob["file"sv].AsString(), Ob["size"sv].AsUInt64());
NeedList.push_back(FileHash);
}
@@ -437,7 +438,7 @@ HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::pat
std::filesystem::path SandboxDir{CreateNewSandbox()};
- spdlog::debug("setting up job in sandbox '{}'", SandboxDir);
+ ZEN_DEBUG("setting up job in sandbox '{}'", SandboxDir);
zen::DeleteDirectories(SandboxDir);
zen::CreateDirectories(SandboxDir);
@@ -452,7 +453,7 @@ HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::pat
if (IoBuffer Chunk = m_CasStore.FindChunk(FileHash); !Chunk)
{
- spdlog::debug("MISSING: {} {} {}", FileHash, FileName, FileSize);
+ ZEN_DEBUG("MISSING: {} {} {}", FileHash, FileName, FileSize);
AllOk = false;
NeedList.push_back(FileHash);
@@ -479,7 +480,7 @@ HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::pat
std::wstring Executable = Utf8ToWide(Executable8);
std::wstring Args = Utf8ToWide(Args8);
- spdlog::debug("spawning job in sandbox '{}': '{}' '{}'", SandboxDir, Executable8, Args8);
+ ZEN_DEBUG("spawning job in sandbox '{}': '{}' '{}'", SandboxDir, Executable8, Args8);
std::filesystem::path ExeName = SandboxDir / Executable;
@@ -515,7 +516,7 @@ HttpLaunchService::HandleRequest(HttpServerRequest& Request)
{
if (m_Router.HandleRequest(Request) == false)
{
- m_Log.warn("No route found for {0}", Request.RelativeUri());
+ ZEN_WARN("No route found for {0}", Request.RelativeUri());
}
}
diff --git a/zenserver/testing/launch.h b/zenserver/testing/launch.h
index a6eb137d2..49f12e2ec 100644
--- a/zenserver/testing/launch.h
+++ b/zenserver/testing/launch.h
@@ -2,9 +2,9 @@
#pragma once
+#include <zencore/logging.h>
#include <zenhttp/httpserver.h>
-#include <spdlog/spdlog.h>
#include <filesystem>
namespace zen {
@@ -24,7 +24,9 @@ public:
virtual void HandleRequest(HttpServerRequest& Request) override;
private:
- spdlog::logger m_Log;
+ inline spdlog::logger& Log() { return m_Log; }
+
+ spdlog::logger& m_Log;
HttpRequestRouter m_Router;
CasStore& m_CasStore;
std::filesystem::path m_SandboxPath;