go-log/internal_logger_begin.go

31 lines
471 B
Go
Raw Normal View History

2021-02-10 19:29:47 +00:00
package flog
import (
"runtime"
2021-02-10 19:40:40 +00:00
"time"
2021-02-10 19:29:47 +00:00
)
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)
2021-02-10 19:40:40 +00:00
switch casted := logger.(type) {
case *internalLogger:
casted.begin = time.Now()
}
2021-02-10 19:29:47 +00:00
2021-02-10 19:47:48 +00:00
a = append([]interface{}{"BEGIN "}, a...)
2021-02-10 19:29:47 +00:00
logger.Debug(a...)
return logger
}