You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
842 B

package cluster
import "darvaza.org/slog"
type logger interface {
withDebug() (slog.Logger, bool)
withInfo() (slog.Logger, bool)
debug() slog.Logger
info() slog.Logger
warn(error) slog.Logger
error(error) slog.Logger
}
var (
_ logger = (*Zones)(nil)
)
func (z *Zones) withDebug() (slog.Logger, bool) {
return z.debug().WithEnabled()
}
func (z *Zones) withInfo() (slog.Logger, bool) {
return z.debug().WithEnabled()
}
func (z *Zones) debug() slog.Logger {
return z.log.Debug()
}
func (z *Zones) info() slog.Logger {
return z.log.Info()
}
func (z *Zones) warn(err error) slog.Logger {
l := z.log.Warn()
if err != nil {
l = l.WithField(slog.ErrorFieldName, err)
}
return l
}
func (z *Zones) error(err error) slog.Logger {
l := z.log.Error()
if err != nil {
l = l.WithField(slog.ErrorFieldName, err)
}
return l
}