// ErrorLogging returns a Decorator which logs an Exchanger's errors to the given
// logger.
4861
func ErrorLogging(l *log.Logger) Decorator {
	return func(ex Exchanger) Exchanger {
		return Func(func(m *dns.Msg, a string) (r *dns.Msg, rtt time.Duration, err error) {
			defer func() {
				if err != nil {
					l.Printf("%v: exchanging %#v with %q", err, m, a)
				}
			}()
			return ex.Exchange(m, a)
		})
	}
}
704655
func LogError(ctx context.Context, err error, data log.Data) {
	data = addLogData(ctx, data)

	log.ErrorCtx(ctx, err, data)
}
1041881
func (l *Logger) Errorf(format string, args ...interface{}) {
	msg := fmt.Sprintf(format, args...)
	l.Error(msg)
}
105886
func (l *Logger) Err(msg string) error {
	return l.logMsg(nil, LEVEL_ERR, msg)
}
303723
func (logger *Logger) Errorf(m string, args ...interface{}) {
	logger.log(ERROR, m, args...)
}
796892
func (l *Logger) Error(message string, props Properties) {
	l.log(Error, message, props)
}
366862
func (s *SyslogLogger) Error(v ...interface{}) {
	s.w.Err(fmt.Sprint(v...))
}
22675
func (l *Logger) Error(v ...interface{}) {
	if l.getLevel() <= Error {
		l.getHandler().Log(l.name, Error, fmt.Sprint(v...), 1)
	}
}
973101
func (l *Logger) Error(msg string) {
	l.errorLogger.Log(l.messageKey, msg)
}
571149
func (l *tmLogger) Error(msg string, keyvals ...interface{}) {
	lWithLevel := kitlevel.Error(l.srcLogger)
	lWithMsg := kitlog.With(lWithLevel, msgKey, msg)
	if err := lWithMsg.Log(keyvals...); err != nil {
		lWithMsg.Log("err", err)
	}
}
740950
func (l *Logger) Err(v interface{}) {
	if l.checkLogLevel(ErrLevel) {
		l.Output(time.Now(), ErrLevel, formatError(v))
	}
}
269996
func (l *badgerLogger) Errorf(format string, v ...interface{}) {
	l.logf(logLevelError, format, v...)
}
706951
func ErrorLoggerT(typ gin.ErrorType) gin.HandlerFunc {
	return func(c *gin.Context) {
		c.Next()

		if !c.Writer.Written() {
			json := c.Errors.ByType(typ).JSON()
			if json != nil {
				c.JSON(-1, json)
			}
		}
	}
}
1195379
func (l *Logger) Error(v ...interface{}) {
	if l.Level >= ErrorLevel {
		l.Logger.Print(ErrorLevel.String() + fmt.Sprint(v...))
	}
}
1039689
func Error(msg string, fields map[string]interface{}) error {
	return defaultLogger.Log(LvError, msg, fields)
}
534669
func Instrumentation(total, success, failure logging.Counter) Decorator {
	return func(ex Exchanger) Exchanger {
		return Func(func(m *dns.Msg, a string) (r *dns.Msg, rtt time.Duration, err error) {
			defer func() {
				if total.Inc(); err != nil {
					failure.Inc()
				} else {
					success.Inc()
				}
			}()
			return ex.Exchange(m, a)
		})
	}
}
1038771
func initializeLogging(logFile, logLevel string) {
	log = backendLog.Logger("SRVR")
	exchanges.UseLogger(xcLogger)
	logDir, _ := filepath.Split(logFile)
	err := os.MkdirAll(logDir, 0700)
	if err != nil {
		log.Errorf("failed to create log directory: %v", err)
		os.Exit(1)
	}
	r, err := rotator.New(logFile, 10*1024, false, 3)
	if err != nil {
		log.Errorf("failed to create file rotator: %v\n", err)
		os.Exit(1)
	}
	logRotator = r
	if logLevel != "" {
		level, ok := slog.LevelFromString(logLevel)
		if ok {
			log.SetLevel(level)
			xcLogger.SetLevel(level)
		} else {
			log.Infof("Unable to assign logging level=%s. Falling back to level=info", logLevel)
		}
	}
}