1// Copyright 2015 Keybase, Inc. All rights reserved. Use of 2// this source code is governed by the included BSD license. 3 4package logger 5 6// Loggerf is a minimal log interface (using proper formatter style methods) 7type Loggerf interface { 8 Debugf(s string, args ...interface{}) 9 Infof(s string, args ...interface{}) 10 Warningf(s string, args ...interface{}) 11 Errorf(s string, args ...interface{}) 12} 13 14type loggerInternal interface { 15 Debug(s string, args ...interface{}) 16 Info(s string, args ...interface{}) 17 Warning(s string, args ...interface{}) 18 Errorf(s string, args ...interface{}) 19} 20 21type logf struct { 22 log loggerInternal 23} 24 25// NewLoggerf adapts a logger 26func NewLoggerf(log loggerInternal) Loggerf { 27 return logf{log: log} 28} 29 30// Debugf forwards to Logger.Debug 31func (l logf) Debugf(s string, args ...interface{}) { 32 l.log.Debug(s, args...) 33} 34 35// Infof forwards to Logger.Info 36func (l logf) Infof(s string, args ...interface{}) { 37 l.log.Info(s, args...) 38} 39 40// Warningf forwards to Logger.Warning 41func (l logf) Warningf(s string, args ...interface{}) { 42 l.log.Warning(s, args...) 43} 44 45// Errorf forwards to Logger.Errorf 46func (l logf) Errorf(s string, args ...interface{}) { 47 l.log.Errorf(s, args...) 48} 49