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()
AlertMuted() bool
Begin(...interface{}) Logger
Debug(...interface{})
Debugf(string, ...interface{})
MuteDebug()
UnmuteDebug()
DebugMuted() bool
End(...interface{})
Error(...interface{}) error
Errorf(string, ...interface{}) error
MuteError()