remove internal logging for package gtimer

This commit is contained in:
John Guo
2021-07-15 21:46:56 +08:00
parent 03d51bd18c
commit b192b7dd60
2 changed files with 10 additions and 13 deletions

View File

@ -69,7 +69,11 @@ func PrintFunc(ctx context.Context, f func() string) {
if !isGFDebug {
return
}
doPrint(ctx, fmt.Sprint(f()), false)
s := f()
if s == "" {
return
}
doPrint(ctx, s, false)
}
// ErrorFunc prints the output from function `f`.
@ -78,7 +82,11 @@ func ErrorFunc(ctx context.Context, f func() string) {
if !isGFDebug {
return
}
doPrint(ctx, fmt.Sprint(f()), true)
s := f()
if s == "" {
return
}
doPrint(ctx, s, true)
}
func doPrint(ctx context.Context, content string, stack bool) {

View File

@ -7,13 +7,8 @@
package gtimer
import (
"context"
"fmt"
"github.com/gogf/gf/container/gtype"
"github.com/gogf/gf/internal/intlog"
"math"
"reflect"
"runtime"
)
// Entry is the timing job.
@ -61,13 +56,7 @@ func (entry *Entry) Run() {
entry.SetStatus(StatusReady)
}
}()
intlog.PrintFunc(context.TODO(), func() string {
return fmt.Sprintf(`job start: %s`, runtime.FuncForPC(reflect.ValueOf(entry.job).Pointer()).Name())
})
entry.job()
intlog.PrintFunc(context.TODO(), func() string {
return fmt.Sprintf(`job done: %s`, runtime.FuncForPC(reflect.ValueOf(entry.job).Pointer()).Name())
})
}()
}