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/cache/cachestore.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/cache/cachestore.cpp')
| -rw-r--r-- | zenserver/cache/cachestore.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/zenserver/cache/cachestore.cpp b/zenserver/cache/cachestore.cpp index 44aa4c892..2fc253a07 100644 --- a/zenserver/cache/cachestore.cpp +++ b/zenserver/cache/cachestore.cpp @@ -85,7 +85,7 @@ FileCacheStore::FileCacheStore(const char* RootDir, const char* ReadRootDir) { // Ensure root directory exists - create if it doesn't exist already - spdlog::info("Initializing FileCacheStore at '{}'", std::string_view(RootDir)); + ZEN_INFO("Initializing FileCacheStore at '{}'", std::string_view(RootDir)); m_RootDir = RootDir; @@ -98,7 +98,7 @@ FileCacheStore::FileCacheStore(const char* RootDir, const char* ReadRootDir) ExtendableStringBuilder<256> Name; WideToUtf8(m_RootDir.c_str(), Name); - spdlog::error("Could not open file cache directory '{}' for writing ({})", Name.c_str(), ErrorCode.message()); + ZEN_ERROR("Could not open file cache directory '{}' for writing ({})", Name.c_str(), ErrorCode.message()); m_IsOk = false; } @@ -109,7 +109,7 @@ FileCacheStore::FileCacheStore(const char* RootDir, const char* ReadRootDir) if (std::filesystem::exists(m_ReadRootDir, ErrorCode)) { - spdlog::info("FileCacheStore will use additional read tree at '{}'", std::string_view(ReadRootDir)); + ZEN_INFO("FileCacheStore will use additional read tree at '{}'", std::string_view(ReadRootDir)); m_ReadRootIsValid = true; } @@ -145,7 +145,7 @@ FileCacheStore::Get(std::string_view Key, CacheValue& OutValue) if (FAILED(hRes)) { - spdlog::debug("GET MISS {}", Key); + ZEN_DEBUG("GET MISS {}", Key); return false; } @@ -162,7 +162,7 @@ FileCacheStore::Get(std::string_view Key, CacheValue& OutValue) OutValue.Value = IoBuffer(IoBuffer::File, File.Detach(), 0, FileSize); - spdlog::debug("GET HIT {}", Key); + ZEN_DEBUG("GET HIT {}", Key); return true; } @@ -180,7 +180,7 @@ FileCacheStore::Put(std::string_view Key, const CacheValue& Value) CAtlTemporaryFile File; - spdlog::debug("PUT {}", Key); + ZEN_DEBUG("PUT {}", Key); HRESULT hRes = File.Create(m_RootDir.c_str()); @@ -205,11 +205,11 @@ FileCacheStore::Put(std::string_view Key, const CacheValue& Value) if (FAILED(hRes)) { - spdlog::warn("Failed to rename temp file for key '{}' - deleting temporary file", Key); + ZEN_WARN("Failed to rename temp file for key '{}' - deleting temporary file", Key); if (!DeleteFile(File.TempFileName())) { - spdlog::warn("Temp file for key '{}' could not be deleted - no value persisted", Key); + ZEN_WARN("Temp file for key '{}' could not be deleted - no value persisted", Key); } } } |