diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-07 16:36:48 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-07 19:11:03 +0200 |
commit | f55d2f43769053b80b419a690554e747dc5dcede (patch) | |
tree | f8c5bdc95df123f2abb04d66b87af4bf9237f086 /common | |
parent | 282f1aa3db9f6420fdd360e46db1ffadd5b083a1 (diff) |
tpl/fmt: Add erroridf template func
Fixes #8613
Diffstat (limited to 'common')
-rw-r--r-- | common/loggers/ignorableLogger.go | 8 | ||||
-rw-r--r-- | common/loggers/loggers.go | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/common/loggers/ignorableLogger.go b/common/loggers/ignorableLogger.go index 766aae07c..0a130900d 100644 --- a/common/loggers/ignorableLogger.go +++ b/common/loggers/ignorableLogger.go @@ -22,6 +22,7 @@ import ( type IgnorableLogger interface { Logger Errorsf(statementID, format string, v ...interface{}) + Apply(logger Logger) IgnorableLogger } type ignorableLogger struct { @@ -55,3 +56,10 @@ ignoreErrors = [%q]`, statementID) l.Errorf(format, v...) } + +func (l ignorableLogger) Apply(logger Logger) IgnorableLogger { + return ignorableLogger{ + Logger: logger, + statements: l.statements, + } +} diff --git a/common/loggers/loggers.go b/common/loggers/loggers.go index c9b5d21be..4ed188016 100644 --- a/common/loggers/loggers.go +++ b/common/loggers/loggers.go @@ -59,6 +59,8 @@ type Logger interface { Println(v ...interface{}) PrintTimerIfDelayed(start time.Time, name string) Debug() *log.Logger + Debugf(format string, v ...interface{}) + Debugln(v ...interface{}) Info() *log.Logger Infof(format string, v ...interface{}) Infoln(v ...interface{}) @@ -108,6 +110,14 @@ func (l *logger) Debug() *log.Logger { return l.DEBUG } +func (l *logger) Debugf(format string, v ...interface{}) { + l.DEBUG.Printf(format, v...) +} + +func (l *logger) Debugln(v ...interface{}) { + l.DEBUG.Println(v...) +} + func (l *logger) Infof(format string, v ...interface{}) { l.INFO.Printf(format, v...) } |