Documentation ¶
Index ¶
- Variables
- func CtxDebugf(ctx context.Context, msg string, args ...interface{})
- func CtxDebugw(ctx context.Context, msg string, kvs ...KeyValue)
- func CtxErrorf(ctx context.Context, msg string, args ...interface{})
- func CtxErrorw(ctx context.Context, msg string, kvs ...KeyValue)
- func CtxInfof(ctx context.Context, msg string, args ...interface{})
- func CtxInfow(ctx context.Context, msg string, kvs ...KeyValue)
- func CtxLogf(ctx context.Context, level Level, msg string, args ...interface{})
- func CtxLogw(ctx context.Context, level Level, msg string, kvs ...KeyValue)
- func CtxNoticef(ctx context.Context, msg string, args ...interface{})
- func CtxNoticew(ctx context.Context, msg string, kvs ...KeyValue)
- func CtxWarnf(ctx context.Context, msg string, args ...interface{})
- func CtxWarnw(ctx context.Context, msg string, kvs ...KeyValue)
- func CtxWithKVs(ctx context.Context, kvs ...KeyValue) context.Context
- func Debugf(msg string, args ...interface{})
- func Debugw(msg string, kvs ...KeyValue)
- func Errorf(msg string, args ...interface{})
- func Errorw(msg string, kvs ...KeyValue)
- func Infof(msg string, args ...interface{})
- func Infow(msg string, kvs ...KeyValue)
- func Logf(level Level, msg string, args ...interface{})
- func Logw(level Level, msg string, kvs ...KeyValue)
- func Noticef(msg string, args ...interface{})
- func Noticew(msg string, kvs ...KeyValue)
- func Warnf(msg string, args ...interface{})
- func Warnw(msg string, kvs ...KeyValue)
- func WithOption(opts ...Option)
- type KeyValue
- func CtxGetKVs(ctx context.Context) []KeyValue
- func FlatKVs(kvis ...interface{}) []KeyValue
- func KV(key string, value interface{}) KeyValue
- func KVCallDepth(key string, depth int) KeyValue
- func KVDefaultCallDepth(key string) KeyValue
- func KVDefaultTimestamp(key string) KeyValue
- func KVTimestamp(key string, layout string) KeyValue
- type Level
- type Logger
- func (l *Logger) CtxDebugf(ctx context.Context, msg string, args ...interface{})
- func (l *Logger) CtxDebugw(ctx context.Context, msg string, kvs ...KeyValue)
- func (l *Logger) CtxErrorf(ctx context.Context, msg string, args ...interface{})
- func (l *Logger) CtxErrorw(ctx context.Context, msg string, kvs ...KeyValue)
- func (l *Logger) CtxInfof(ctx context.Context, msg string, args ...interface{})
- func (l *Logger) CtxInfow(ctx context.Context, msg string, kvs ...KeyValue)
- func (l *Logger) CtxLogf(ctx context.Context, level Level, msg string, args ...interface{})
- func (l *Logger) CtxLogw(ctx context.Context, level Level, msg string, kvs ...KeyValue)
- func (l *Logger) CtxNoticef(ctx context.Context, msg string, args ...interface{})
- func (l *Logger) CtxNoticew(ctx context.Context, msg string, kvs ...KeyValue)
- func (l *Logger) CtxWarnf(ctx context.Context, msg string, args ...interface{})
- func (l *Logger) CtxWarnw(ctx context.Context, msg string, kvs ...KeyValue)
- func (l *Logger) Debugf(msg string, args ...interface{})
- func (l *Logger) Debugw(msg string, kvs ...KeyValue)
- func (l *Logger) Errorf(msg string, args ...interface{})
- func (l *Logger) Errorw(msg string, kvs ...KeyValue)
- func (l *Logger) Infof(msg string, args ...interface{})
- func (l *Logger) Infow(msg string, kvs ...KeyValue)
- func (l *Logger) Logf(level Level, msg string, args ...interface{})
- func (l *Logger) Logw(level Level, msg string, kvs ...KeyValue)
- func (l *Logger) Noticef(msg string, args ...interface{})
- func (l *Logger) Noticew(msg string, kvs ...KeyValue)
- func (l *Logger) Warnf(msg string, args ...interface{})
- func (l *Logger) Warnw(msg string, kvs ...KeyValue)
- func (l *Logger) WithOption(opts ...Option) *Logger
- type Option
- type Provider
- type Valuer
Constants ¶
This section is empty.
Variables ¶
var DefaultLogger = defaultLogger
Functions ¶
func CtxNoticef ¶
CtxNoticef prints key-value pairs first and then msgs
func CtxNoticew ¶
CtxNoticew prints key-value pairs
func CtxWithKVs ¶
CtxWithKVs append key-value pairs to context
Types ¶
type KeyValue ¶
type KeyValue struct { Key string Value interface{} }
KeyValue is a key-value pair
func FlatKVs ¶
func FlatKVs(kvis ...interface{}) []KeyValue
FlatKVs returns key-value pairs from flat interface slice
func KVCallDepth ¶
KVCallDepth returns a Valuer that returns a pkg/file:line description of the caller.
func KVDefaultCallDepth ¶
func KVDefaultTimestamp ¶
func KVTimestamp ¶
KVTimestamp returns a timestamp Valuer with a custom time format.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a logger implementation
func (*Logger) CtxNoticef ¶
CtxNoticef prints key-value pairs first and then msgs
func (*Logger) CtxNoticew ¶
CtxNoticew prints key-value pairs
func (*Logger) WithOption ¶
WithOption append options to logger
type Option ¶
type Option func(*option)
func WithProvider ¶
WithProvider returns an option that sets a provider
type Provider ¶
Provider is the lowest level implementation of log writing
func NewMultiProvider ¶
NewMultiProvider creates a provider that duplicates its writes to all providers
func NewStdProvider ¶
func NewStdProvider() Provider