diff options
| author | Stefan Boberg <[email protected]> | 2021-09-15 11:27:48 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-15 11:27:48 +0200 |
| commit | 2b9bed6635d95e15847c4d9b602e34d90e277d14 (patch) | |
| tree | 66fb191150ccbf9f56315a716abd23b25cc1d401 /zenserver/zenserver.cpp | |
| parent | xmake: added zenhttp dependency to make zen CLI tool buld (diff) | |
| download | zen-2b9bed6635d95e15847c4d9b602e34d90e277d14.tar.xz zen-2b9bed6635d95e15847c4d9b602e34d90e277d14.zip | |
Changed logging implementation
* Code should no longer directly `#include spdlog/spdlog.h`, instead use `#include <zencore/logging.h>`
* Instead of explicit calls to `spdlog::info(...)` and such please use the logging macros defined in `zencore/logging.h`. I.e `ZEN_INFO`, `ZEN_DEBUG`, `ZEN_TRACE`, `ZEN_ERROR`, `ZEN_CRITITCAL`
* The macros will pick up the "most local" logger via a `Log()` call to retrieve a logger instance. To override the default logger in a class please implement your own `Log()` function
Diffstat (limited to 'zenserver/zenserver.cpp')
| -rw-r--r-- | zenserver/zenserver.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index f1a3ca05f..931fe062e 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -88,7 +88,7 @@ public: void Initialize(ZenServiceConfig& ServiceConfig, int BasePort, int ParentPid) { using namespace fmt::literals; - spdlog::info(ZEN_APP_NAME " initializing"); + ZEN_INFO(ZEN_APP_NAME " initializing"); m_DebugOptionForcedCrash = ServiceConfig.ShouldCrash; @@ -98,11 +98,11 @@ public: if (!m_Process.IsValid()) { - spdlog::warn("Unable to initialize process handle for specified parent pid #{}", ParentPid); + ZEN_WARN("Unable to initialize process handle for specified parent pid #{}", ParentPid); } else { - spdlog::info("Using parent pid #{} to control process lifetime", ParentPid); + ZEN_INFO("Using parent pid #{} to control process lifetime", ParentPid); } } @@ -117,7 +117,7 @@ public: // Ok so now we're configured, let's kick things off - spdlog::info("initializing storage"); + ZEN_INFO("initializing storage"); zen::CasStoreConfiguration Config; Config.RootDirectory = m_DataRoot / "cas"; @@ -126,13 +126,13 @@ public: m_CidStore = std::make_unique<zen::CidStore>(*m_CasStore, m_DataRoot / "cid"); - spdlog::info("instantiating project service"); + ZEN_INFO("instantiating project service"); m_ProjectStore = new zen::ProjectStore(*m_CasStore, m_DataRoot / "projects"); m_HttpProjectService.reset(new zen::HttpProjectService{*m_CasStore, m_ProjectStore}); m_LocalProjectService = zen::LocalProjectService::New(*m_CasStore, m_ProjectStore); - spdlog::info("instantiating compute services"); + ZEN_INFO("instantiating compute services"); std::filesystem::path SandboxDir = m_DataRoot / "exec" / "sandbox"; zen::CreateDirectories(SandboxDir); @@ -147,7 +147,7 @@ public: using namespace std::literals; auto ValueOrDefault = [](std::string_view Value, std::string_view Default) { return Value.empty() ? Default : Value; }; - spdlog::info("instantiating structured cache service"); + ZEN_INFO("instantiating structured cache service"); m_CacheStore = std::make_unique<ZenCacheStore>(*m_CasStore, m_DataRoot / "cache"); std::unique_ptr<zen::UpstreamCache> UpstreamCache; @@ -201,12 +201,12 @@ public: if (UpstreamCache->Initialize()) { - spdlog::info("upstream cache active"); + ZEN_INFO("upstream cache active"); } else { UpstreamCache.reset(); - spdlog::info("NOT using upstream cache"); + ZEN_INFO("NOT using upstream cache"); } } @@ -215,7 +215,7 @@ public: } else { - spdlog::info("NOT instantiating structured cache service"); + ZEN_INFO("NOT instantiating structured cache service"); } if (ServiceConfig.MeshEnabled) @@ -224,7 +224,7 @@ public: } else { - spdlog::info("NOT starting mesh"); + ZEN_INFO("NOT starting mesh"); } m_Http = zen::CreateHttpServer(); @@ -261,7 +261,7 @@ public: void StartMesh(int BasePort) { - spdlog::info("initializing mesh discovery"); + ZEN_INFO("initializing mesh discovery"); m_ZenMesh.Start(uint16_t(BasePort)); } @@ -274,15 +274,15 @@ public: if (!m_TestMode) { - spdlog::info("__________ _________ __ "); - spdlog::info("\\____ /____ ____ / _____// |_ ___________ ____ "); - spdlog::info(" / // __ \\ / \\ \\_____ \\\\ __\\/ _ \\_ __ \\_/ __ \\ "); - spdlog::info(" / /\\ ___/| | \\ / \\| | ( <_> ) | \\/\\ ___/ "); - spdlog::info("/_______ \\___ >___| / /_______ /|__| \\____/|__| \\___ >"); - spdlog::info(" \\/ \\/ \\/ \\/ \\/ "); + ZEN_INFO("__________ _________ __ "); + ZEN_INFO("\\____ /____ ____ / _____// |_ ___________ ____ "); + ZEN_INFO(" / // __ \\ / \\ \\_____ \\\\ __\\/ _ \\_ __ \\_/ __ \\ "); + ZEN_INFO(" / /\\ ___/| | \\ / \\| | ( <_> ) | \\/\\ ___/ "); + ZEN_INFO("/_______ \\___ >___| / /_______ /|__| \\____/|__| \\___ >"); + ZEN_INFO(" \\/ \\/ \\/ \\/ \\/ "); } - spdlog::info(ZEN_APP_NAME " now running"); + ZEN_INFO(ZEN_APP_NAME " now running"); #if USE_SENTRY sentry_clear_modulecache(); @@ -295,7 +295,7 @@ public: m_Http->Run(m_TestMode); - spdlog::info(ZEN_APP_NAME " exiting"); + ZEN_INFO(ZEN_APP_NAME " exiting"); m_IoContext.stop(); @@ -308,7 +308,7 @@ public: m_Http->RequestExit(); } - void Cleanup() { spdlog::info(ZEN_APP_NAME " cleaning up"); } + void Cleanup() { ZEN_INFO(ZEN_APP_NAME " cleaning up"); } void SetDedicatedMode(bool State) { m_IsDedicatedMode = State; } void SetTestMode(bool State) { m_TestMode = State; } @@ -338,7 +338,7 @@ public: } else { - spdlog::info(ZEN_APP_NAME " exiting since parent process id {} is gone", m_Process.Pid()); + ZEN_INFO(ZEN_APP_NAME " exiting since parent process id {} is gone", m_Process.Pid()); RequestExit(0); } @@ -415,7 +415,7 @@ main(int argc, char* argv[]) ParseServiceConfig(GlobalOptions.DataDir, /* out */ ServiceConfig); - spdlog::info("zen cache server starting on port {}", GlobalOptions.BasePort); + ZEN_INFO("zen cache server starting on port {}", GlobalOptions.BasePort); try { @@ -427,7 +427,7 @@ main(int argc, char* argv[]) { // Instance already running for this port? Should double check pid - spdlog::warn("Looks like there is already a process listening to this port (pid: {})", Entry->Pid); + ZEN_WARN("Looks like there is already a process listening to this port (pid: {})", Entry->Pid); } else { @@ -450,9 +450,9 @@ main(int argc, char* argv[]) // Monitor shutdown signals ShutdownThread.reset(new std::thread{[&] { - spdlog::info("shutdown monitor thread waiting for shutdown signal '{}'", ShutdownEventName); + ZEN_INFO("shutdown monitor thread waiting for shutdown signal '{}'", ShutdownEventName); ShutdownEvent->Wait(); - spdlog::info("shutdown signal received"); + ZEN_INFO("shutdown signal received"); Server.RequestExit(0); }}); |