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
856 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 = (*Cluster)(nil)
)
func (z *Cluster) withDebug() (slog.Logger, bool) {
return z.debug().WithEnabled()
}
func (z *Cluster) withInfo() (slog.Logger, bool) {
return z.debug().WithEnabled()
}
func (z *Cluster) debug() slog.Logger {
return z.log.Debug()
}
func (z *Cluster) info() slog.Logger {
return z.log.Info()
}
func (z *Cluster) warn(err error) slog.Logger {
l := z.log.Warn()
if err != nil {
l = l.WithField(slog.ErrorFieldName, err)
}
return l
}
func (z *Cluster) error(err error) slog.Logger {
l := z.log.Error()
if err != nil {
l = l.WithField(slog.ErrorFieldName, err)
}
return l
}