aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-10-25 17:42:16 +0200
committerGitHub <[email protected]>2023-10-25 17:42:16 +0200
commit1fd6883e242522d0b822baf280873ebf98fd1c51 (patch)
tree58650cb932e4a470042a5a3534e699b39536b5f3 /src/zencore/include
parentstatsd metrics reporting (#496) (diff)
downloadzen-1fd6883e242522d0b822baf280873ebf98fd1c51.tar.xz
zen-1fd6883e242522d0b822baf280873ebf98fd1c51.zip
eliminate redundant logging code (#499)
zenutil and zenserver both contain very similar logging setup code and this change aims to make them have most code in common. * fullformatter/jsonformatter/RotatingFileSink are moved into dedicated header files in zenutil * zenserver `InitializeLogging`/`ShutdownLogging` are renamed `InitializeServerLogging`/`InitializeServerLogging` * these now call into the common zenutil `BeginInitializeLogging`/`FinishInitializeLogging` in addition to setting up server custom logging * `std::filesystem::path` is now logged after stripping any `\\\\?\\` prefix for readability
Diffstat (limited to 'src/zencore/include')
-rw-r--r--src/zencore/include/zencore/fmtutils.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/zencore/include/zencore/fmtutils.h b/src/zencore/include/zencore/fmtutils.h
index a927df866..3d29625be 100644
--- a/src/zencore/include/zencore/fmtutils.h
+++ b/src/zencore/include/zencore/fmtutils.h
@@ -58,9 +58,18 @@ struct fmt::formatter<std::filesystem::path> : formatter<string_view>
template<typename FormatContext>
auto format(const std::filesystem::path& Path, FormatContext& ctx)
{
+ using namespace std::literals;
+
zen::ExtendableStringBuilder<128> String;
String << Path.u8string();
- return fmt::formatter<string_view>::format(String.ToView(), ctx);
+ std::string_view PathView = String.ToView();
+
+ if (PathView.starts_with("\\\\?\\"sv))
+ {
+ PathView.remove_prefix(4);
+ }
+
+ return fmt::formatter<string_view>::format(PathView, ctx);
}
};