mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
remove internal logging for package gtimer
This commit is contained in:
@ -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) {
|
||||
|
||||
@ -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())
|
||||
})
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user