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"
)
func (receiver internalLogger) CanLogDebug() bool {
return !receiver.mutedDebug
func (receiver internalLogger) DebugMuted() bool {
return receiver.mutedDebug
}
func (receiver internalLogger) Debug(a ...interface{}) {
if !receiver.CanLogDebug() {
if receiver.DebugMuted() {
return
}
if nil == receiver.writer {
@ -24,7 +24,7 @@ func (receiver internalLogger) Debug(a ...interface{}) {
}
func (receiver internalLogger) Debugf(format string, a ...interface{}) {
if !receiver.CanLogDebug() {
if receiver.DebugMuted() {
return
}

View File

@ -6,8 +6,8 @@ import (
"strings"
)
func (receiver internalLogger) CanLogError() bool {
return !receiver.mutedError
func (receiver internalLogger) ErrorMuted() bool {
return receiver.mutedError
}
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 {
err := fmt.Errorf(format, a...)
if !receiver.CanLogError() {
if receiver.ErrorMuted() {
return err
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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