aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-26 22:06:16 +0200
committerStefan Boberg <[email protected]>2021-09-26 22:06:16 +0200
commitb527b0a120defc51fc27e8d0a95bc4f689a7e8f4 (patch)
tree8dd5961dee915d9962f0743c81ebf4191a3bcdf9
parentAdded HttpVerb ToString() function for use in logging (diff)
downloadzen-b527b0a120defc51fc27e8d0a95bc4f689a7e8f4.tar.xz
zen-b527b0a120defc51fc27e8d0a95bc4f689a7e8f4.zip
Added http_requests logger for (optionally) logging HTTP requests
-rw-r--r--zenserver/diag/logging.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/zenserver/diag/logging.cpp b/zenserver/diag/logging.cpp
index 41b140f90..bc7b883b5 100644
--- a/zenserver/diag/logging.cpp
+++ b/zenserver/diag/logging.cpp
@@ -258,6 +258,18 @@ InitializeLogging(const ZenServerOptions& GlobalOptions)
}
#endif
+ // HTTP server request logging
+
+ std::filesystem::path HttpLogPath = GlobalOptions.DataDir / "logs/http.log";
+
+ auto HttpSink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(zen::WideToUtf8(HttpLogPath.c_str()),
+ /* max size */ 128 * 1024 * 1024,
+ /* max files */ 16,
+ /* rotate on open */ true);
+
+ auto HttpLogger = std::make_shared<spdlog::logger>("http_requests", HttpSink);
+ spdlog::register_logger(HttpLogger);
+
// Jupiter - only log HTTP traffic to file
auto JupiterLogger = std::make_shared<spdlog::logger>("jupiter", FileSink);