mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 01:30:25 +08:00
ac321fc146
* backup * simplify * chore: remove unused pool * chore: fix lint errors * chore: use strings.Builder instead of bytes.Buffer * test: add more tests * chore: fix reviewdog * test: fix data race * feat: make logger customizable * chore: fix reviewdog * test: fix fails * chore: fix set writer twice * chore: use context instead of golang.org context * chore: specify uint32 for level types
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package logx
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// A Logger represents a logger.
|
|
type Logger interface {
|
|
// Error logs a message at error level.
|
|
Error(...interface{})
|
|
// Errorf logs a message at error level.
|
|
Errorf(string, ...interface{})
|
|
// Errorv logs a message at error level.
|
|
Errorv(interface{})
|
|
// Errorw logs a message at error level.
|
|
Errorw(string, ...LogField)
|
|
// Info logs a message at info level.
|
|
Info(...interface{})
|
|
// Infof logs a message at info level.
|
|
Infof(string, ...interface{})
|
|
// Infov logs a message at info level.
|
|
Infov(interface{})
|
|
// Infow logs a message at info level.
|
|
Infow(string, ...LogField)
|
|
// Slow logs a message at slow level.
|
|
Slow(...interface{})
|
|
// Slowf logs a message at slow level.
|
|
Slowf(string, ...interface{})
|
|
// Slowv logs a message at slow level.
|
|
Slowv(interface{})
|
|
// Sloww logs a message at slow level.
|
|
Sloww(string, ...LogField)
|
|
// WithContext returns a new logger with the given context.
|
|
WithContext(context.Context) Logger
|
|
// WithDuration returns a new logger with the given duration.
|
|
WithDuration(time.Duration) Logger
|
|
}
|