Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Path string `mapstructure:"path" ini:"path" json:"path" toml:"path" xml:"path" yaml:"path" validate:"required,file"` // 日志文件存储位置 Prefix string `mapstructure:"prefix" ini:"prefix" json:"prefix" toml:"prefix" xml:"prefix" yaml:"prefix" validate:"required"` // 日志文件前缀 Suffix *Suffix `mapstructure:"suffix" ini:"log.file.suffix" json:"suffix" toml:"suffix" xml:"suffix" yaml:"suffix" validate:"required"` // 日志文件后缀 Max *Max `mapstructure:"max" ini:"log.file.max" json:"max" toml:"max" xml:"max" yaml:"max" validate:"required"` // 日志文件最大参数 }
日志输出到文件
type Logger ¶
type Logger struct { Record string `` // 日志记录器 /* 130-byte string literal not displayed */ Develop bool `mapstructure:"develop" ini:"develop" json:"develop" toml:"develop" xml:"develop" yaml:"develop" validate:"required"` // 是否是开发模式 Namespace string `` // 日志命名空间 /* 127-byte string literal not displayed */ Format string `mapstructure:"format" ini:"format" json:"format" toml:"format" xml:"format" yaml:"format" validate:"required,oneof=text json"` // 日志格式: ["text"(默认),"json"] Output *OutPut `mapstructure:"output" ini:"log.output" json:"output" toml:"output" xml:"output" yaml:"output" validate:"required"` // 日志输出类型 Logrus *Logrus `mapstructure:"logrus" ini:"log.logrus" json:"logrus" toml:"logrus" xml:"logrus" yaml:"logrus" validate:"-"` // zap日志配置信息 Zap *Zap `mapstructure:"zap" ini:"log.zap" json:"zap" toml:"zap" xml:"zap" yaml:"zap" validate:"-"` // zap日志配置信息 File *File `mapstructure:"file" ini:"log.output.file" json:"file" toml:"file" xml:"file" yaml:"file" validate:"-"` // 输出到 文件 }
func (*Logger) InitLogrus ¶
func (log *Logger) InitLogrus()
type Logrus ¶
type Logrus struct { Level string `` // 日志级别: [trace>debug>info(默认)>warn>error>fatal>panic] /* 149-byte string literal not displayed */ }
type Max ¶
type Max struct { Size int `mapstructure:"size" ini:"size" json:"size" toml:"size" xml:"size" yaml:"size" validate:"required"` // 日志文件大小(M) Backups int `mapstructure:"backups" ini:"backups" json:"backups" toml:"backups" xml:"backups" yaml:"backups" validate:"required"` // 最多存在多少个切片文件 Age int `mapstructure:"age" ini:"age" json:"age" toml:"age" xml:"age" yaml:"age" validate:"required"` // 保存的最大天数 }
日志文件最大参数
type OutPut ¶
type OutPut struct { Console bool `mapstructure:"console" ini:"console" json:"console" toml:"console" xml:"console" yaml:"console" validate:"-"` // 输出到 控制台 File bool `mapstructure:"file" ini:"file" json:"file" toml:"file" xml:"file" yaml:"file" validate:"-"` // 输出到 文件 Kafka bool `mapstructure:"kafka" ini:"kafka" json:"kafka" toml:"kafka" xml:"kafka" yaml:"kafka" validate:"-"` // 输出到 kafka Redis bool `mapstructure:"redis" ini:"redis" json:"redis" toml:"redis" xml:"redis" yaml:"redis" validate:"-"` // 输出到 redis Influxdb bool `mapstructure:"influxdb" ini:"influxdb" json:"influxdb" toml:"influxdb" xml:"influxdb" yaml:"influxdb" validate:"-"` // 输出到 influxdb Mysql bool `mapstructure:"mysql" ini:"mysql" json:"mysql" toml:"mysql" xml:"mysql" yaml:"mysql" validate:"-"` // 输出到 mysql }
日志输出
type Suffix ¶
type Suffix struct { Trace string `mapstructure:"trace" ini:"trace" json:"trace" toml:"trace" xml:"trace" yaml:"trace" validate:"required"` // trace 日志文件后缀 Debug string `mapstructure:"debug" ini:"debug" json:"debug" toml:"debug" xml:"debug" yaml:"debug" validate:"required"` // debug 日志文件后缀 Info string `mapstructure:"info" ini:"info" json:"info" toml:"info" xml:"info" yaml:"info" validate:"required"` // info 日志文件后缀 Warn string `mapstructure:"warn" ini:"warn" json:"warn" toml:"warn" xml:"warn" yaml:"warn" validate:"required"` // warn 日志文件后缀 Error string `mapstructure:"error" ini:"error" json:"error" toml:"error" xml:"error" yaml:"error" validate:"required"` // error 日志文件后缀 Dpanic string `mapstructure:"dpanic" ini:"dpanic" json:"dpanic" toml:"dpanic" xml:"dpanic" yaml:"dpanic" validate:"required"` // dpanic 日志文件后缀 Panic string `mapstructure:"panic" ini:"panic" json:"panic" toml:"panic" xml:"panic" yaml:"panic" validate:"required"` // panic 日志文件后缀 Fatal string `mapstructure:"fatal" ini:"fatal" json:"fatal" toml:"fatal" xml:"fatal" yaml:"fatal" validate:"required"` // fatal 日志文件后缀 }
日志文件后缀
Click to show internal directories.
Click to hide internal directories.