begin, end

master
Charles Iliya Krempeaux 2021-02-10 11:29:47 -08:00
parent 002575bd70
commit e7446423ca
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package flog
import (
"runtime"
)
func (receiver internalLogger) Begin(a ...interface{}) Logger {
var funcName string = "<([-UNKNOWN-])>"
{
pc, _, _, ok := runtime.Caller(1)
if ok {
fn := runtime.FuncForPC(pc)
funcName = fn.Name()
}
}
logger := receiver.Prefix(funcName)
a = append([]interface{}{"BEGIN"}, a...)
logger.Debug(a...)
return logger
}

View File

@ -0,0 +1,7 @@
package flog
func (receiver internalLogger) End(a ...interface{}) {
a = append([]interface{}{"END"}, a...)
receiver.Debug(a...)
}

View File

@ -7,12 +7,16 @@ type Logger interface {
UnmuteAlert() UnmuteAlert()
AlertMuted() bool AlertMuted() bool
Begin(...interface{}) Logger
Debug(...interface{}) Debug(...interface{})
Debugf(string, ...interface{}) Debugf(string, ...interface{})
MuteDebug() MuteDebug()
UnmuteDebug() UnmuteDebug()
DebugMuted() bool DebugMuted() bool
End(...interface{})
Error(...interface{}) error Error(...interface{}) error
Errorf(string, ...interface{}) error Errorf(string, ...interface{}) error
MuteError() MuteError()