Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShortError ¶
ShortError contructs a field which only records the error message without the verbose text (i.e. excludes the stack trace).
Types ¶
type Config ¶
type Config struct { // Log level. // One of "debug", "info", "warn", "error", "dpanic", "panic", and "fatal". Level string `toml:"level" json:"level"` // Log filename, leave empty to disable file log. File string `toml:"file" json:"file"` // Max size for a single file, in MB. FileMaxSize int `toml:"max-size" json:"max-size"` // Max log keep days, default is never deleting. FileMaxDays int `toml:"max-days" json:"max-days"` // Maximum number of old log files to retain. FileMaxBackups int `toml:"max-backups" json:"max-backups"` // Format of the log, one of `text`, `json` or `console`. Format string `toml:"format" json:"format"` }
Config serializes log related config in toml/json.
type Logger ¶
Logger wraps the zap logger.
func InitAppLogger ¶
func InitAppLogger(cfg *Config) (Logger, *pclog.ZapProperties, error)
InitAppLogger inits the wrapped logger from config.
func NewAppLogger ¶
NewAppLogger returns the wrapped logger from config.
Click to show internal directories.
Click to hide internal directories.