feat: 日志输出IP

This commit is contained in:
zhushenwudi 2025-01-14 20:50:31 +08:00
parent 11eaaa43d3
commit 479ad3acd4
2 changed files with 6 additions and 4 deletions

View File

@ -1,8 +1,8 @@
# 打包命令
# docker buildx build -t zhushenwudi/lovelive-sif2:1.0.1 --platform=linux/amd64 .
# docker buildx build -t zhushenwudi/lovelive-sif2:1.0.2 -t zhushenwudi/lovelive-sif2:latest --platform=linux/amd64 .
# 使用适用于 Linux x86 的基础映像
# 保存镜像
# docker save -o lovelive-sif2.tar zhushenwudi/lovelive-sif2:1.0.1
# docker save -o lovelive-sif2.tar zhushenwudi/lovelive-sif2:1.0.2
FROM docker.io/library/debian:latest AS builder

View File

@ -119,7 +119,8 @@ async fn run_server(in_thread: bool) -> std::io::Result<()> {
let webui_server = HttpServer::new(|| {
App::new()
.wrap_fn(|req, srv| {
logger::info(&format!("WebUI Request: {}", req.path())); // 使用日志记录
let ip = req.peer_addr().map(|addr| addr.ip().to_string()).unwrap_or_else(|| "Unknown IP".to_string());
logger::info(&format!("from {}, WebUI Request: {}", ip, req.path()));
srv.call(req)
})
.app_data(web::PayloadConfig::default().limit(1024 * 1024 * 25))
@ -137,7 +138,8 @@ async fn run_server(in_thread: bool) -> std::io::Result<()> {
asset_server = Some(HttpServer::new(|| {
App::new()
.wrap_fn(|req, srv| {
logger::info(&format!("Assets Request: {}", req.path()));
let ip = req.peer_addr().map(|addr| addr.ip().to_string()).unwrap_or_else(|| "Unknown IP".to_string());
logger::info(&format!("from {}, Assets Request: {}", ip, req.path()));
srv.call(req)
})
.app_data(web::PayloadConfig::default().limit(1024 * 1024 * 1024))