add Debugfn and Infofn to logx/logc #4595 (#4598)

This commit is contained in:
Devin
2025-01-25 22:21:50 +08:00
committed by GitHub
parent 7d05a4bc93
commit 64e8c94198
5 changed files with 80 additions and 1 deletions

View File

@@ -42,6 +42,11 @@ func Debugv(ctx context.Context, v interface{}) {
getLogger(ctx).Debugv(v)
}
// Debugfn writes fn result into access log.
func Debugfn(ctx context.Context, fn func() string) {
getLogger(ctx).Debugfn(fn)
}
// Debugw writes msg along with fields into the access log.
func Debugw(ctx context.Context, msg string, fields ...LogField) {
getLogger(ctx).Debugw(msg, fields...)
@@ -88,6 +93,11 @@ func Infov(ctx context.Context, v any) {
getLogger(ctx).Infov(v)
}
// Infofn writes fn result into access log.
func Infofn(ctx context.Context, fn func() string) {
getLogger(ctx).Infofn(fn)
}
// Infow writes msg along with fields into the access log.
func Infow(ctx context.Context, msg string, fields ...LogField) {
getLogger(ctx).Infow(msg, fields...)