add config

This commit is contained in:
ginuerzh
2021-10-29 13:35:44 +08:00
parent 3351aa5974
commit 16ddfba1d1
36 changed files with 1024 additions and 207 deletions

View File

@ -29,7 +29,7 @@ func newLogger(name string) *logger {
// EnableJSONOutput enables JSON formatted output log.
func (l *logger) EnableJSONOutput(enabled bool) {
l.logger.Logger.SetFormatter(&logrus.JSONFormatter{})
}
// SetOutputLevel sets log output level
@ -45,44 +45,44 @@ func (l *logger) WithFields(fields map[string]interface{}) Logger {
}
}
// Info logs a message at level Info.
func (l *logger) Info(args ...interface{}) {
l.logger.Log(logrus.InfoLevel, args...)
}
// Infof logs a message at level Info.
func (l *logger) Infof(format string, args ...interface{}) {
l.logger.Logf(logrus.InfoLevel, format, args...)
}
// Debug logs a message at level Debug.
func (l *logger) Debug(args ...interface{}) {
l.logger.Log(logrus.DebugLevel, args...)
l.logger.Debug(args...)
}
// Debugf logs a message at level Debug.
func (l *logger) Debugf(format string, args ...interface{}) {
l.logger.Logf(logrus.DebugLevel, format, args...)
l.logger.Debugf(format, args...)
}
// Info logs a message at level Info.
func (l *logger) Info(args ...interface{}) {
l.logger.Info(args...)
}
// Infof logs a message at level Info.
func (l *logger) Infof(format string, args ...interface{}) {
l.logger.Infof(format, args...)
}
// Warn logs a message at level Warn.
func (l *logger) Warn(args ...interface{}) {
l.logger.Log(logrus.WarnLevel, args...)
l.logger.Warn(args...)
}
// Warnf logs a message at level Warn.
func (l *logger) Warnf(format string, args ...interface{}) {
l.logger.Logf(logrus.WarnLevel, format, args...)
l.logger.Warnf(format, args...)
}
// Error logs a message at level Error.
func (l *logger) Error(args ...interface{}) {
l.logger.Log(logrus.ErrorLevel, args...)
l.logger.Error(args...)
}
// Errorf logs a message at level Error.
func (l *logger) Errorf(format string, args ...interface{}) {
l.logger.Logf(logrus.ErrorLevel, format, args...)
l.logger.Errorf(format, args...)
}
// Fatal logs a message at level Fatal then the process will exit with status set to 1.