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 /zenstore | |
| 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 'zenstore')
| -rw-r--r-- | zenstore/CAS.cpp | 4 | ||||
| -rw-r--r-- | zenstore/caslog.cpp | 2 | ||||
| -rw-r--r-- | zenstore/cidstore.cpp | 4 | ||||
| -rw-r--r-- | zenstore/filecas.cpp | 12 |
4 files changed, 11 insertions, 11 deletions
diff --git a/zenstore/CAS.cpp b/zenstore/CAS.cpp index 10a17d89a..e77c0ed64 100644 --- a/zenstore/CAS.cpp +++ b/zenstore/CAS.cpp @@ -8,11 +8,11 @@ #include <doctest/doctest.h> #include <zencore/except.h> #include <zencore/fmtutils.h> +#include <zencore/logging.h> #include <zencore/memory.h> #include <zencore/string.h> #include <zencore/thread.h> #include <zencore/uid.h> -#include <zencore/logging.h> #include <gsl/gsl-lite.hpp> @@ -63,7 +63,7 @@ CasImpl::Initialize(const CasStoreConfiguration& InConfig) { m_Config = InConfig; - spdlog::info("initializing CAS pool at {}", m_Config.RootDirectory); + ZEN_INFO("initializing CAS pool at {}", m_Config.RootDirectory); // Ensure root directory exists - create if it doesn't exist already diff --git a/zenstore/caslog.cpp b/zenstore/caslog.cpp index 39135f537..34860538a 100644 --- a/zenstore/caslog.cpp +++ b/zenstore/caslog.cpp @@ -7,11 +7,11 @@ #include <zencore/except.h> #include <zencore/filesystem.h> #include <zencore/fmtutils.h> +#include <zencore/logging.h> #include <zencore/memory.h> #include <zencore/string.h> #include <zencore/thread.h> #include <zencore/uid.h> -#include <zencore/logging.h> #include <xxhash.h> diff --git a/zenstore/cidstore.cpp b/zenstore/cidstore.cpp index 5a9ed9483..e6c7f98ee 100644 --- a/zenstore/cidstore.cpp +++ b/zenstore/cidstore.cpp @@ -4,9 +4,9 @@ #include <zencore/compress.h> #include <zencore/filesystem.h> +#include <zencore/logging.h> #include <zenstore/CAS.h> #include <zenstore/caslog.h> -#include <zencore/logging.h> #include <filesystem> @@ -86,7 +86,7 @@ struct CidStore::CidState m_LogFile.Replay([&](const IndexEntry& Ie) { m_CidMap.insert_or_assign(Ie.Uncompressed, Ie.Compressed); }); - spdlog::debug("CID index initialized: {} entries found", m_CidMap.size()); + ZEN_DEBUG("CID index initialized: {} entries found", m_CidMap.size()); } void Flush() { m_LogFile.Flush(); } diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp index df42de412..170f13875 100644 --- a/zenstore/filecas.cpp +++ b/zenstore/filecas.cpp @@ -5,11 +5,11 @@ #include <zencore/except.h> #include <zencore/filesystem.h> #include <zencore/fmtutils.h> +#include <zencore/logging.h> #include <zencore/memory.h> #include <zencore/string.h> #include <zencore/thread.h> #include <zencore/uid.h> -#include <zencore/logging.h> #include <gsl/gsl-lite.hpp> @@ -84,7 +84,7 @@ FileCasStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash) if (!Success) { - spdlog::warn("Failed to flag temporary payload file for deletion: '{}'", PathFromHandle(FileRef.FileHandle)); + ZEN_WARN("Failed to flag temporary payload file for deletion: '{}'", PathFromHandle(FileRef.FileHandle)); } }; @@ -173,9 +173,9 @@ FileCasStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash) return CasStore::InsertResult{.New = true}; } - spdlog::warn("rename of CAS payload file failed ('{}'), falling back to regular write for insert of {}", - GetLastErrorAsString(), - ChunkHash); + ZEN_WARN("rename of CAS payload file failed ('{}'), falling back to regular write for insert of {}", + GetLastErrorAsString(), + ChunkHash); DeletePayloadFileOnClose(); } @@ -224,7 +224,7 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize if ((hRes != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) && (hRes != HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND))) { - spdlog::warn("Unexpected error code when opening shard file for read: {:#x}", uint32_t(hRes)); + ZEN_WARN("Unexpected error code when opening shard file for read: {:#x}", uint32_t(hRes)); } auto InternalCreateFile = [&] { return PayloadFile.Create(ShardedPath.c_str(), GENERIC_WRITE, FILE_SHARE_DELETE, CREATE_ALWAYS); }; |