优化日志记录

This commit is contained in:
xugo
2025-08-20 11:57:55 +08:00
parent 994a14e1f7
commit cd31004a10
7 changed files with 8 additions and 4 deletions

View File

@@ -11,6 +11,8 @@ ADD ./www ./www
# 创建配置目录
RUN mkdir -p configs
RUN chown -R $USER:$USER /opt/media/bin
# 添加元数据标签
LABEL Name=gowvp \
Version=0.0.1 \

View File

@@ -111,6 +111,7 @@ services:
# 如果拉不到 docker hub 镜像,也可以尝试
# registry.cn-shanghai.aliyuncs.com/ixugo/homenvr:latest
image: gospace/gowvp:latest
restart: unless-stopped
# linux 解开下行注释,并将 ports 全部注释
# network_mode: host
ports:
@@ -129,6 +130,7 @@ services:
- 20000-20100:20000-20100 # gb28181 收流端口
- 20000-20100:20000-20100/udp # gb28181 收流端口udp
volumes:
# 日志目录是 configs/logs
- ./data:/opt/media/bin/configs
```

View File

@@ -3,6 +3,7 @@ services:
# 如果拉不到 docker hub 镜像,也可以尝试
# registry.cn-shanghai.aliyuncs.com/ixugo/homenvr:latest
image: gospace/gowvp:latest
restart: unless-stopped
# linux 解开下行注释,并将 ports 全部注释
# network_mode: host
ports:

View File

@@ -108,7 +108,6 @@ func setupZLM(ctx context.Context, dir string) {
// 启动命令
if err := cmd.Run(); err != nil {
slog.Error("zlm 运行失败", "err", err)
continue
}
time.Sleep(5 * time.Second)
}

View File

@@ -45,7 +45,7 @@ func DefaultConfig() Bootstrap {
},
Log: Log{
Dir: "./logs",
Level: "info",
Level: "error",
MaxAge: Duration(7 * 24 * time.Hour),
RotationTime: Duration(8 * time.Hour),
RotationSize: 50,

View File

@@ -64,7 +64,7 @@ func main() {
func configIsNotExistWrite(path string) {
if _, err := os.Stat(path); os.IsNotExist(err) {
if err := conf.WriteConfig(conf.DefaultConfig(), path); err != nil {
system.ErrPrintf("WriteConfig", "err", err)
system.ErrPrintf("WriteConfig err[%s]", err)
}
}
}

View File

@@ -288,7 +288,7 @@ func (s *Server) handlerRequest(msg *Request) {
}
handlers, ok := s.route.Load(strings.ToUpper(key))
if !ok {
slog.Error("not found handler func,string:", "method", msg.Method(), "msg", msg.String())
slog.Debug("not found handler func", "method", msg.Method(), "msg", msg.String())
go handlerMethodNotAllowed(msg, tx)
return
}