fix logger,cache

This commit is contained in:
2025-10-02 18:06:23 +08:00
parent 10ee9bba10
commit f934472e50
9 changed files with 869 additions and 12 deletions

View File

@@ -1,13 +1,14 @@
package conf
type Base struct {
Service string `yaml:"Service"` // 服务名称
Port string `yaml:"Port"` // 服务监听端口,0为自动随机端口
Cache string `yaml:"Cache"` // REDIS缓存
SecretKey string `yaml:"SecretKey"` // 服务秘钥
BindIP string `yaml:"BindIP"` // 绑定IP
Addr string `yaml:"Addr"`
OnMicroService bool `yaml:"OnMicroService"`
Service string `yaml:"Service"` // 服务名称
Port string `yaml:"Port"` // 服务监听端口,0为自动随机端口
Cache string `yaml:"Cache"` // REDIS缓存
SecretKey string `yaml:"SecretKey"` // 服务秘钥
BindIP string `yaml:"BindIP"` // 绑定IP
Addr string `yaml:"Addr"`
Log *LogConf `yaml:"Log"` // 日志配置
OnMicroService bool `yaml:"OnMicroService"`
}
type DBConf struct {
@@ -69,3 +70,35 @@ type TlsConf struct {
CertFile string // 证书文件路径
KeyFile string // 密钥文件路径
}
type WebSocketConf struct {
ReadBufferSize int `yaml:"ReadBufferSize"`
WriteBufferSize int `yaml:"WriteBufferSize"`
CheckOrigin bool `yaml:"CheckOrigin"`
PingPeriod string `yaml:"PingPeriod"`
PongWait string `yaml:"PongWait"`
WriteWait string `yaml:"WriteWait"`
MaxMessageSize int64 `yaml:"MaxMessageSize"`
HandshakeTimeout string `yaml:"HandshakeTimeout"`
}
// LogLevel 日志级别
type LogLevel int
const (
DEBUG LogLevel = iota
INFO
WARN
ERROR
FATAL
)
type LogConf struct {
Name string `yaml:"Name"`
Level LogLevel `yaml:"Level"`
Dir string `yaml:"Dir"`
Endpoint string `yaml:"Endpoint"`
Console bool `yaml:"Console"`
File bool `yaml:"File"`
Remote bool `yaml:"Remote"`
}