master
Charles Iliya Krempeaux 2021-02-04 18:51:05 -08:00
parent 36a701420c
commit aa91e4c6a1
9 changed files with 37 additions and 37 deletions

View File

@ -6,12 +6,12 @@ import (
"strings" "strings"
) )
func (receiver internalLogger) CanLogDebug() bool { func (receiver internalLogger) DebugMuted() bool {
return !receiver.mutedDebug return receiver.mutedDebug
} }
func (receiver internalLogger) Debug(a ...interface{}) { func (receiver internalLogger) Debug(a ...interface{}) {
if !receiver.CanLogDebug() { if receiver.DebugMuted() {
return return
} }
if nil == receiver.writer { if nil == receiver.writer {
@ -24,7 +24,7 @@ func (receiver internalLogger) Debug(a ...interface{}) {
} }
func (receiver internalLogger) Debugf(format string, a ...interface{}) { func (receiver internalLogger) Debugf(format string, a ...interface{}) {
if !receiver.CanLogDebug() { if receiver.DebugMuted() {
return return
} }

View File

@ -6,8 +6,8 @@ import (
"strings" "strings"
) )
func (receiver internalLogger) CanLogError() bool { func (receiver internalLogger) ErrorMuted() bool {
return !receiver.mutedError return receiver.mutedError
} }
func (receiver internalLogger) Error(a ...interface{}) error { func (receiver internalLogger) Error(a ...interface{}) error {
@ -19,7 +19,7 @@ func (receiver internalLogger) Error(a ...interface{}) error {
func (receiver internalLogger) Errorf(format string, a ...interface{}) error { func (receiver internalLogger) Errorf(format string, a ...interface{}) error {
err := fmt.Errorf(format, a...) err := fmt.Errorf(format, a...)
if !receiver.CanLogError() { if receiver.ErrorMuted() {
return err return err
} }

View File

@ -7,8 +7,8 @@ import (
"strings" "strings"
) )
func (receiver internalLogger) CanLogFatal() bool { func (receiver internalLogger) FatalMuted() bool {
return !receiver.mutedFatal return receiver.mutedFatal
} }
func (receiver internalLogger) Fatal(a ...interface{}) { func (receiver internalLogger) Fatal(a ...interface{}) {
@ -18,7 +18,7 @@ func (receiver internalLogger) Fatal(a ...interface{}) {
} }
func (receiver internalLogger) Fatalf(format string, a ...interface{}) { func (receiver internalLogger) Fatalf(format string, a ...interface{}) {
if !receiver.CanLogFatal() { if receiver.FatalMuted() {
os.Exit(1) os.Exit(1)
return return
} }

View File

@ -6,12 +6,12 @@ import (
"strings" "strings"
) )
func (receiver internalLogger) CanLogHighlight() bool { func (receiver internalLogger) HighlightMuted() bool {
return !receiver.mutedHighlight return receiver.mutedHighlight
} }
func (receiver internalLogger) Highlight(a ...interface{}) { func (receiver internalLogger) Highlight(a ...interface{}) {
if !receiver.CanLogHighlight() { if receiver.HighlightMuted() {
return return
} }
if nil == receiver.writer { if nil == receiver.writer {
@ -24,7 +24,7 @@ func (receiver internalLogger) Highlight(a ...interface{}) {
} }
func (receiver internalLogger) Highlightf(format string, a ...interface{}) { func (receiver internalLogger) Highlightf(format string, a ...interface{}) {
if !receiver.CanLogHighlight() { if receiver.HighlightMuted() {
return return
} }

View File

@ -6,12 +6,12 @@ import (
"strings" "strings"
) )
func (receiver internalLogger) CanLogInform() bool { func (receiver internalLogger) InformMuted() bool {
return !receiver.mutedInform return receiver.mutedInform
} }
func (receiver internalLogger) Inform(a ...interface{}) { func (receiver internalLogger) Inform(a ...interface{}) {
if !receiver.CanLogInform() { if receiver.InformMuted() {
return return
} }
if nil == receiver.writer { if nil == receiver.writer {
@ -24,7 +24,7 @@ func (receiver internalLogger) Inform(a ...interface{}) {
} }
func (receiver internalLogger) Informf(format string, a ...interface{}) { func (receiver internalLogger) Informf(format string, a ...interface{}) {
if !receiver.CanLogInform() { if receiver.InformMuted() {
return return
} }

View File

@ -6,8 +6,8 @@ import (
"strings" "strings"
) )
func (receiver internalLogger) CanLogPanic() bool { func (receiver internalLogger) PanicMuted() bool {
return !receiver.mutedPanic return receiver.mutedPanic
} }
func (receiver internalLogger) Panic(a ...interface{}) { func (receiver internalLogger) Panic(a ...interface{}) {
@ -19,7 +19,7 @@ func (receiver internalLogger) Panic(a ...interface{}) {
func (receiver internalLogger) Panicf(format string, a ...interface{}) { func (receiver internalLogger) Panicf(format string, a ...interface{}) {
err := fmt.Errorf(format, a...) err := fmt.Errorf(format, a...)
if !receiver.CanLogPanic() { if receiver.PanicMuted() {
panic(err) panic(err)
} }

View File

@ -6,12 +6,12 @@ import (
"strings" "strings"
) )
func (receiver internalLogger) CanLogTrace() bool { func (receiver internalLogger) TraceMuted() bool {
return !receiver.mutedTrace return receiver.mutedTrace
} }
func (receiver internalLogger) Trace(a ...interface{}) { func (receiver internalLogger) Trace(a ...interface{}) {
if !receiver.CanLogTrace() { if receiver.TraceMuted() {
return return
} }
if nil == receiver.writer { if nil == receiver.writer {
@ -24,7 +24,7 @@ func (receiver internalLogger) Trace(a ...interface{}) {
} }
func (receiver internalLogger) Tracef(format string, a ...interface{}) { func (receiver internalLogger) Tracef(format string, a ...interface{}) {
if !receiver.CanLogTrace() { if receiver.TraceMuted() {
return return
} }

View File

@ -6,12 +6,12 @@ import (
"strings" "strings"
) )
func (receiver internalLogger) CanLogWarn() bool { func (receiver internalLogger) WarnMuted() bool {
return !receiver.mutedWarn return receiver.mutedWarn
} }
func (receiver internalLogger) Warn(a ...interface{}) { func (receiver internalLogger) Warn(a ...interface{}) {
if !receiver.CanLogWarn() { if receiver.WarnMuted() {
return return
} }
if nil == receiver.writer { if nil == receiver.writer {
@ -24,7 +24,7 @@ func (receiver internalLogger) Warn(a ...interface{}) {
} }
func (receiver internalLogger) Warnf(format string, a ...interface{}) { func (receiver internalLogger) Warnf(format string, a ...interface{}) {
if !receiver.CanLogWarn() { if receiver.WarnMuted() {
return return
} }

View File

@ -1,45 +1,45 @@
package flog package flog
type Logger interface { type Logger interface {
CanLogDebug() bool
Debug(...interface{}) Debug(...interface{})
Debugf(string, ...interface{}) Debugf(string, ...interface{})
MuteDebug() MuteDebug()
DebugMuted() bool
CanLogError() bool
Error(...interface{}) error Error(...interface{}) error
Errorf(string, ...interface{}) error Errorf(string, ...interface{}) error
MuteError() MuteError()
ErrorMuted() bool
CanLogFatal() bool
Fatal(...interface{}) Fatal(...interface{})
Fatalf(string, ...interface{}) Fatalf(string, ...interface{})
MuteFatal() MuteFatal()
FatalMuted() bool
CanLogHighlight() bool
Highlight(...interface{}) Highlight(...interface{})
Highlightf(string, ...interface{}) Highlightf(string, ...interface{})
MuteHighlight() MuteHighlight()
HighlightMuted() bool
CanLogInform() bool
Inform(...interface{}) Inform(...interface{})
Informf(string, ...interface{}) Informf(string, ...interface{})
MuteInform() MuteInform()
InformMuted() bool
CanLogPanic() bool
Panic(...interface{}) Panic(...interface{})
Panicf(string, ...interface{}) Panicf(string, ...interface{})
MutePanic() MutePanic()
PanicMuted() bool
CanLogTrace() bool
Trace(...interface{}) Trace(...interface{})
Tracef(string, ...interface{}) Tracef(string, ...interface{})
MuteTrace() MuteTrace()
TraceMuted() bool
CanLogWarn() bool
Warn(...interface{}) Warn(...interface{})
Warnf(string, ...interface{}) Warnf(string, ...interface{})
MuteWarn() MuteWarn()
WarnMuted() bool
Prefix(...string) Logger Prefix(...string) Logger
} }