diff options
| author | Dan Engelbrecht <[email protected]> | 2022-08-26 13:37:19 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-08-26 04:37:19 -0700 |
| commit | 57ba63d2f63847934b8d197a77c1eca292ed6e41 (patch) | |
| tree | bce9d3038b3eadc83f6b330dee3300509ec550cf /zenserver/diag/logging.cpp | |
| parent | redefine vcpkg cache naming (diff) | |
| download | zen-57ba63d2f63847934b8d197a77c1eca292ed6e41.tar.xz zen-57ba63d2f63847934b8d197a77c1eca292ed6e41.zip | |
Use "\\?\" prefixed paths and fix hardcoded path delimiters (#149)
* use "\\?\" prefix for windows paths
* fix path delimiters
* disable vcpkg caching
* Workaround for spdlog not being able to create directories prefixed with `\\?\`
Diffstat (limited to 'zenserver/diag/logging.cpp')
| -rw-r--r-- | zenserver/diag/logging.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/zenserver/diag/logging.cpp b/zenserver/diag/logging.cpp index 3a5da2de9..887b0421d 100644 --- a/zenserver/diag/logging.cpp +++ b/zenserver/diag/logging.cpp @@ -203,7 +203,7 @@ InitializeLogging(const ZenServerOptions& GlobalOptions) EnableVTMode(); std::filesystem::path LogPath = - !GlobalOptions.AbsLogFile.empty() ? GlobalOptions.AbsLogFile : GlobalOptions.DataDir / "logs/zenserver.log"; + !GlobalOptions.AbsLogFile.empty() ? GlobalOptions.AbsLogFile : GlobalOptions.DataDir / "logs" / "zenserver.log"; bool IsAsync = true; spdlog::level::level_enum LogLevel = spdlog::level::info; @@ -234,6 +234,9 @@ InitializeLogging(const ZenServerOptions& GlobalOptions) auto ConsoleSink = std::make_shared<spdlog::sinks::ansicolor_stdout_sink_mt>(); + // spdlog can't create directories that starts with `\\?\` so we make sure the folder exists before creating the logger instance + zen::CreateDirectories(LogPath.parent_path()); + #if 0 auto FileSink = std::make_shared<spdlog::sinks::daily_file_sink_mt>(zen::PathToUtf8(LogPath), 0, @@ -267,7 +270,10 @@ InitializeLogging(const ZenServerOptions& GlobalOptions) // HTTP server request logging - std::filesystem::path HttpLogPath = GlobalOptions.DataDir / "logs/http.log"; + std::filesystem::path HttpLogPath = GlobalOptions.DataDir / "logs" / "http.log"; + + // spdlog can't create directories that starts with `\\?\` so we make sure the folder exists before creating the logger instance + zen::CreateDirectories(HttpLogPath.parent_path()); auto HttpSink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(zen::PathToUtf8(HttpLogPath), /* max size */ 128 * 1024 * 1024, |