Documentation
¶
Index ¶
- func Debug(msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func ExplainSQL(sql string, vars ...interface{}) string
- func Fatal(msg string, fields ...zap.Field)
- func GetAccessLogger() *zap.Logger
- func GetLogger() *zap.Logger
- func Info(msg string, fields ...zap.Field)
- func InitLogger(cfg *Config, printLog string) error
- func Middleware() echo.MiddlewareFunc
- func Named(name string) *zap.Logger
- func Panic(msg string, fields ...zap.Field)
- func Warn(msg string, fields ...zap.Field)
- func With(fields ...zap.Field) *zap.Logger
- type AccessConfig
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Error ¶
Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func ExplainSQL ¶
func Fatal ¶
Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.
func Info ¶
Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func InitLogger ¶
func Middleware ¶
func Middleware() echo.MiddlewareFunc
func Panic ¶
Panic logs a message at PanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then panics, even if logging at PanicLevel is disabled.
Types ¶
type AccessConfig ¶
type AccessConfig struct {
// Log filename, leave empty to disable file log.
Filename string `toml:"filename" json:"filename"`
// Max size for a single file, in MB.
MaxSize int `toml:"max-size" json:"max-size"`
// Max log keep days, default is never deleting.
MaxDays int `toml:"max-days" json:"max-days"`
// Maximum number of old log files to retain.
MaxBackups int `toml:"max-backups" json:"max-backups"`
}
type Config ¶
type Config struct {
// Http port
Port int `toml:"port" json:"port"`
// Log level.
Level string `toml:"level" json:"level"`
// Log filename, leave empty to disable file log.
Filename string `toml:"filename" json:"filename"`
// Max size for a single file, in MB.
MaxSize int `toml:"max-size" json:"max-size"`
// Max log keep days, default is never deleting.
MaxDays int `toml:"max-days" json:"max-days"`
// Maximum number of old log files to retain.
MaxBackups int `toml:"max-backups" json:"max-backups"`
// Access access log config.
Access AccessConfig `toml:"access" json:"access"`
}
Config serializes log related config in toml/json.