Documentation ¶
Index ¶
- Constants
- Variables
- func Value(ctx context.Context, v interface{}) interface{}
- type Filter
- type FilterOption
- type Helper
- func (h *Helper) Debug(a ...interface{})
- func (h *Helper) DebugF(format string, a ...interface{})
- func (h *Helper) DebugW(keyValues ...interface{})
- func (h *Helper) Error(a ...interface{})
- func (h *Helper) ErrorF(format string, a ...interface{})
- func (h *Helper) ErrorW(keyValues ...interface{})
- func (h *Helper) Fatal(a ...interface{})
- func (h *Helper) FatalF(format string, a ...interface{})
- func (h *Helper) FatalW(keyValues ...interface{})
- func (h *Helper) Info(a ...interface{})
- func (h *Helper) InfoF(format string, a ...interface{})
- func (h *Helper) InfoW(keyValues ...interface{})
- func (h *Helper) Log(level Level, keyValues ...interface{}) error
- func (h *Helper) Warn(a ...interface{})
- func (h *Helper) WarnF(format string, a ...interface{})
- func (h *Helper) WarnW(keyValues ...interface{})
- func (h *Helper) WithContext(ctx context.Context) *Helper
- func (h *Helper) WithValues(kv ...interface{}) *Helper
- type HelperOption
- type Level
- type Logger
- type Valuer
Constants ¶
View Source
const ( DefaultMessageKey = "type" DefaultLogIdKey = "logId" DefaultCallerKey = "caller" DefaultDownstreamKey = "downstream" DefaultConcurrencyLogIdKey = "concurrencyLogId" DefaultWebSocketUUIDKey = "websocketUUID" DefaultWebSocketLogIdKey = "websocketLogId" DefaultCronActionKey = "cronAction" DefaultWebSocketPathKey = "websocketPath" )
View Source
const LevelKey = "level"
Variables ¶
View Source
var ( // DefaultCaller is a Valuer that returns the file and line. DefaultCaller = Caller(4) // DefaultTimestamp is a Valuer that returns the current wallclock time. DefaultTimestamp = Timestamp(time.RFC3339) )
View Source
var DefaultLogger = NewStdLogger(log.Writer())
Functions ¶
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a zaplogger filter.
func NewFilter ¶
func NewFilter(logger Logger, opts ...FilterOption) *Filter
NewFilter new a zaplogger filter.
type FilterOption ¶
type FilterOption func(*Filter)
FilterOption is filter option.
func FilterFunc ¶
func FilterFunc(f func(level Level, keyValues ...interface{}) bool) FilterOption
FilterFunc with filter func.
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
func NewHelper ¶
func NewHelper(logger Logger, opts ...HelperOption) *Helper
func (*Helper) WithValues ¶
type HelperOption ¶
type HelperOption func(*Helper)
func WithSprint ¶
func WithSprint(sprint func(...interface{}) string) HelperOption
WithSprint with sprint
func WithSprintf ¶
func WithSprintf(sprintf func(format string, a ...interface{}) string) HelperOption
WithSprintf with sprintf
type Logger ¶
func NewStdLogger ¶
type Valuer ¶
Valuer is returns a logit value.
func FileWithLineNumCaller ¶
func FileWithLineNumCaller() Valuer
func FileWithLineNumCallerRedis ¶
func FileWithLineNumCallerRedis() Valuer
Click to show internal directories.
Click to hide internal directories.