go-logging(停止维护了)替换成zap, zap的配置完善优化,gva的日志更换zap后的处理

This commit is contained in:
SliverHorn
2020-09-05 11:55:51 +08:00
parent 14ea27749c
commit e810a08c0e
18 changed files with 104 additions and 181 deletions

View File

@@ -1,16 +1,15 @@
package config
type Server struct {
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
Sqlite Sqlite `mapstructure:"sqlite" json:"sqlite" yaml:"sqlite"`
Qiniu Qiniu `mapstructure:"qiniu" json:"qiniu" yaml:"qiniu"`
Casbin Casbin `mapstructure:"casbin" json:"casbin" yaml:"casbin"`
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
System System `mapstructure:"system" json:"system" yaml:"system"`
JWT JWT `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
Log Log `mapstructure:"log" json:"log" yaml:"log"`
Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"`
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
Sqlite Sqlite `mapstructure:"sqlite" json:"sqlite" yaml:"sqlite"`
Qiniu Qiniu `mapstructure:"qiniu" json:"qiniu" yaml:"qiniu"`
Casbin Casbin `mapstructure:"casbin" json:"casbin" yaml:"casbin"`
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
System System `mapstructure:"system" json:"system" yaml:"system"`
JWT JWT `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"`
LocalUpload LocalUpload `mapstructure:"localUpload" json:"localUpload" yaml:"localUpload"`
}
@@ -47,9 +46,9 @@ type Redis struct {
}
type LocalUpload struct {
Local bool `mapstructure:"local" json:"local" yaml:"local"`
Local bool `mapstructure:"local" json:"local" yaml:"local"`
AvatarPath string `mapstructure:"avatar-path" json:"avatarPath" yaml:"avatar-path"`
FilePath string `mapstructure:"file-path" json:"filePath" yaml:"file-path"`
FilePath string `mapstructure:"file-path" json:"filePath" yaml:"file-path"`
}
type Qiniu struct {
@@ -65,13 +64,6 @@ type Captcha struct {
ImgHeight int `mapstructure:"img-height" json:"imgHeight" yaml:"img-height"`
}
type Log struct {
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
LogFile bool `mapstructure:"log-file" json:"logFile" yaml:"log-file"`
Stdout string `mapstructure:"stdout" json:"stdout" yaml:"stdout"`
File string `mapstructure:"file" json:"file" yaml:"file"`
}
type Sqlite struct {
Username string `mapstructure:"username" json:"username" yaml:"username"`
Password string `mapstructure:"password" json:"password" yaml:"password"`
@@ -81,11 +73,13 @@ type Sqlite struct {
}
type Zap struct {
Level string `mapstructure:"level" json:"level" yaml:"level"`
Format string `mapstructure:"format" json:"format" yaml:"format"`
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
Director string `mapstructure:"director" json:"director" yaml:"director"`
LinkName string `mapstructure:"link_name" json:"linkName" yaml:"link_name"`
ShowLine bool `mapstructure:"show_line" json:"show_line" yaml:"show_line"`
LogInConsole bool `mapstructure:"log_in_console" json:"logInConsole" yaml:"log_in_console"`
Level string `mapstructure:"level" json:"level" yaml:"level"`
Format string `mapstructure:"format" json:"format" yaml:"format"`
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
Director string `mapstructure:"director" json:"director" yaml:"director"`
LinkName string `mapstructure:"link_name" json:"linkName" yaml:"link_name"`
ShowLine bool `mapstructure:"show_line" json:"showLine" yaml:"showLine"`
EncodeLevel string `mapstructure:"encode_level" json:"encodeLevel" yaml:"encode_level"`
StacktraceKey string `mapstructure:"stacktrace_key" json:"stacktraceKey" yaml:"stacktrace_key"`
LogInConsole bool `mapstructure:"log_in_console" json:"logInConsole" yaml:"log_in_console"`
}