Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitLogger ¶
InitLogger initializes DM's and also the TiDB library's loggers.
func ShortError ¶
ShortError contructs a field which only records the error message without the verbose text (i.e. excludes the stack trace).
In DM, all errors are almost always propagated back to `main()` where the error stack is written. Including the stack in the middle thus usually just repeats known information. You should almost always use `ShortError` instead of `zap.Error`, unless the error is no longer propagated upwards.
Types ¶
type Config ¶
type Config struct { // Log level. 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"` }
Config serializes log related config in toml/json.
type Logger ¶
Logger is a simple wrapper around *zap.Logger which provides some extra methods to simplify DM's log usage.
func (Logger) ErrorFilterContextCanceled ¶ added in v1.0.3
ErrorFilterContextCanceled wraps Logger.Error() and will filter error log when error is context.Canceled