Documentation
¶
Index ¶
- func GetLevelPriority(level zapcore.Level) zap.LevelEnablerFunc
- type AppConfig
- type CacheConfig
- type CorsConfig
- type CorsItem
- type DbConfig
- type Directories
- type Env
- type JwtConfig
- type Logger
- type SystemConfig
- type ZapConfig
- func (z *ZapConfig) CustomTimeEncoder(t time.Time, encoder zapcore.PrimitiveArrayEncoder)
- func (z *ZapConfig) GetCores() []zapcore.Core
- func (z *ZapConfig) GetEncoder() zapcore.Encoder
- func (z *ZapConfig) GetEncoderConfig() zapcore.EncoderConfig
- func (z *ZapConfig) GetEncoderCore(l zapcore.Level, level zap.LevelEnablerFunc) zapcore.Core
- func (z *ZapConfig) GetWriteSyncer(level string) (zapcore.WriteSyncer, error)
- func (z *ZapConfig) Init() *Logger
- func (z *ZapConfig) TransportLevel() zapcore.Level
- func (z *ZapConfig) ZapEncodeLevel() zapcore.LevelEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLevelPriority ¶
func GetLevelPriority(level zapcore.Level) zap.LevelEnablerFunc
GetLevelPriority 根据 zapcore.Level 获取 zap.LevelEnablerFunc Author [SliverHorn](https://github.com/SliverHorn)
Types ¶
type AppConfig ¶
type AppConfig struct { System SystemConfig `mapstructure:"system" json:"system" yaml:"system"` DB DbConfig `mapstructure:"db" json:"db" yaml:"db"` Zap ZapConfig `mapstructure:"zap" json:"zap" yaml:"zap"` Cors *CorsConfig `mapstructure:"cors" json:"cors" yaml:"cors"` JWT *JwtConfig `mapstructure:"jwt" json:"jwt" yaml:"jwt"` }
func (*AppConfig) CorsEnabled ¶
func (*AppConfig) JwtEnabled ¶
type CacheConfig ¶
type CorsConfig ¶
type CorsItem ¶
type CorsItem struct { AllowOrigin string `mapstructure:"allow-origin" json:"allow-origin" yaml:"allow-origin"` AllowMethods string `mapstructure:"allow-methods" json:"allow-methods" yaml:"allow-methods"` AllowHeaders string `mapstructure:"allow-headers" json:"allow-headers" yaml:"allow-headers"` ExposeHeaders string `mapstructure:"expose-headers" json:"expose-headers" yaml:"expose-headers"` AllowCredentials bool `mapstructure:"allow-credentials" json:"allow-credentials" yaml:"allow-credentials"` }
type DbConfig ¶
type DbConfig struct { Host string `mapstructure:"host" json:"host" yaml:"host"` Port uint `mapstructure:"port" json:"port" yaml:"port"` UserName string `mapstructure:"username" json:"username" yaml:"username"` Password string `mapstructure:"password" json:"password" yaml:"password"` DbName string `mapstructure:"dbname" json:"dbname" yaml:"dbname"` Debug bool `mapstructure:"debug" json:"debug" yaml:"debug"` }
type Directories ¶
type JwtConfig ¶
type JwtConfig struct { Enable bool `mapstructure:"enable" json:"enable" yaml:"enable"` // 是否启用 SigningKey string `mapstructure:"signing-key" json:"signing-key" yaml:"signing-key"` // jwt签名 ExpiresTime string `mapstructure:"expires-time" json:"expires-time" yaml:"expires-time"` // 过期时间 BufferTime string `mapstructure:"buffer-time" json:"buffer-time" yaml:"buffer-time"` // 缓冲时间 Issuer string `mapstructure:"issuer" json:"issuer" yaml:"issuer"` // 签发者 }
type SystemConfig ¶
type SystemConfig struct { Name string `mapstructure:"name" json:"name" yaml:"name"` Env Env `mapstructure:"env" json:"env" yaml:"env"` Host string `mapstructure:"host" json:"host" yaml:"host"` Port int `mapstructure:"port" json:"port" yaml:"port"` Directories *Directories `mapstructure:"directories" json:"directories" yaml:"directories"` WebUrl string `mapstructure:"web-url" json:"web_url" yaml:"web-url"` LogRequest *bool `mapstructure:"log-request" yaml:"log-request"` // 记录系统请求 }
type ZapConfig ¶
type ZapConfig struct { Level string `mapstructure:"level" json:"level" yaml:"level"` // 级别 Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` // 日志前缀 Format string `mapstructure:"format" json:"format" yaml:"format"` // 输出 Directory string `mapstructure:"directory" json:"directory" yaml:"directory"` // 日志文件夹 EncodeLevel string `mapstructure:"encode-level" json:"encode-level" yaml:"encode-level"` // 编码级 StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"` // 栈名 MaxAge int `mapstructure:"max-age" json:"max-age" yaml:"max-age"` // 日志留存时间 ShowLine bool `mapstructure:"show-line" json:"show-line" yaml:"show-line"` // 显示行 LogInConsole bool `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"` // 输出控制台 // }
func (*ZapConfig) CustomTimeEncoder ¶
func (z *ZapConfig) CustomTimeEncoder(t time.Time, encoder zapcore.PrimitiveArrayEncoder)
func (*ZapConfig) GetEncoder ¶
func (*ZapConfig) GetEncoderConfig ¶
func (z *ZapConfig) GetEncoderConfig() zapcore.EncoderConfig
func (*ZapConfig) GetEncoderCore ¶
func (*ZapConfig) GetWriteSyncer ¶
func (z *ZapConfig) GetWriteSyncer(level string) (zapcore.WriteSyncer, error)
func (*ZapConfig) TransportLevel ¶
TransportLevel 根据字符串转化为 zapcore.Level Author [SliverHorn](https://github.com/SliverHorn)
func (*ZapConfig) ZapEncodeLevel ¶
func (z *ZapConfig) ZapEncodeLevel() zapcore.LevelEncoder
ZapEncodeLevel 根据 EncodeLevel 返回 zapcore.LevelEncoder Author [SliverHorn](https://github.com/SliverHorn)
Click to show internal directories.
Click to hide internal directories.