package raftNode

var log *logger = new(logger)

func SetLogger(l LogerInterface) {
	log.log = l
}

type logger struct {
	log LogerInterface
}

func (that *logger) Debug(args ...interface{}) {
	if that.log != nil {
		that.log.Debug(args...)
	}
}

func (that *logger) Debugf(template string, args ...interface{}) {
	if that.log != nil {
		that.log.Debugf(template, args...)
	}
}

func (that *logger) Info(args ...interface{}) {
	if that.log != nil {
		that.log.Info(args...)
	}
}

func (that *logger) Infof(template string, args ...interface{}) {
	if that.log != nil {
		that.log.Infof(template, args...)
	}
}

func (that *logger) Trace(args ...interface{}) {
	if that.log != nil {
		that.log.Trace(args...)
	}
}

func (that *logger) Tracef(template string, args ...interface{}) {
	if that.log != nil {
		that.log.Tracef(template, args...)
	}
}

func (that *logger) Warn(args ...interface{}) {
	if that.log != nil {
		that.log.Warn(args...)
	}
}

func (that *logger) Warnf(template string, args ...interface{}) {
	if that.log != nil {
		that.log.Warnf(template, args...)
	}
}

func (that *logger) Error(args ...interface{}) {
	if that.log != nil {
		that.log.Error(args...)
	}
}

func (that *logger) Errorf(template string, args ...interface{}) {
	if that.log != nil {
		that.log.Errorf(template, args...)
	}
}

func (that *logger) Fatal(args ...interface{}) {
	if that.log != nil {
		that.log.Fatal(args...)
	}
}

func (that *logger) Fatalf(template string, args ...interface{}) {
	if that.log != nil {
		that.log.Fatalf(template, args...)
	}
}

func (that *logger) Panic(args ...interface{}) {
	if that.log != nil {
		that.log.Panic(args...)
	}
}

func (that *logger) Panicf(template string, args ...interface{}) {
	if that.log != nil {
		that.log.Panicf(template, args...)
	}
}
