Documentation
¶
Index ¶
- type Field
- type FieldType
- type Logger
- type ZapLoggerOption
- type ZeroLoggerAlerter
- type ZeroLoggerOption
- func ZeroLoggerWithAsyncSink(size int, pollInterval time.Duration, alerter ZeroLoggerAlerter) ZeroLoggerOption
- func ZeroLoggerWithCaller() ZeroLoggerOption
- func ZeroLoggerWithFields(fields ...Field) ZeroLoggerOption
- func ZeroLoggerWithLevel(level string) ZeroLoggerOption
- func ZeroLoggerWithOutputs(outputs []string) ZeroLoggerOption
- func ZeroLoggerWithStackTraceInError() ZeroLoggerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
// Key for a given field
Key string
// Type of a given field
Type FieldType
// Value of the given field
Value interface{}
// optmizations for string & int
Integer int64
String string
}
Field defines a standard Key-Value pair used to populate the value for the logger
type Logger ¶
type Logger interface {
// Should also implement default kit.log.Logger interface
kit_log.Logger
// Leveled Logging
Info(string, ...Field)
Warn(string, ...Field)
Error(string, ...Field)
Panic(string, ...Field)
Fatal(string, ...Field)
Debug(string, ...Field)
Infof(string, ...interface{})
Errorf(string, ...interface{})
Debugf(string, ...interface{})
// Flush the logs
Flush() error
// Default Fields
With(...Field) Logger
WithContext(cx context.Context) context.Context
}
Logger defines standard set of functions supported by logger and used across the Base Package
func NewNoopLogger ¶
func NewNoopLogger() Logger
func NewZapLogger ¶
func NewZapLogger( options ...ZapLoggerOption, ) (Logger, error)
NewZapLogger returns a default implementaiton of log.Logger interface using uber/zap as core layer
func NewZeroLogger ¶
func NewZeroLogger(options ...ZeroLoggerOption) (Logger, error)
type ZapLoggerOption ¶
type ZapLoggerOption func(*zapLogger)
func ZapWithAppendedOutput ¶
func ZapWithAppendedOutput(outputs []string) ZapLoggerOption
ZapWithAppendedOutput is option to add additional output to list of existing output destination
func ZapWithEncoding ¶
func ZapWithEncoding(encoding string) ZapLoggerOption
ZapWithEncoding is option to set encoding for zap based logger
func ZapWithLevel ¶
func ZapWithLevel(level string) ZapLoggerOption
ZapWithLevel is option to set level for Zap Based Logger
func ZapWithOutput ¶
func ZapWithOutput(outputs []string) ZapLoggerOption
ZapWithOutput is option to set output paths for zap based logger
type ZeroLoggerAlerter ¶
type ZeroLoggerAlerter func(missed int)
Alerter is used to notify, how many messages were dropped
example:
func(missed int) {
fmt.Printf("Logger Dropped %d messages", missed)
}
type ZeroLoggerOption ¶
type ZeroLoggerOption func(*zeroLoggerConfig) error
func ZeroLoggerWithAsyncSink ¶
func ZeroLoggerWithAsyncSink( size int, pollInterval time.Duration, alerter ZeroLoggerAlerter, ) ZeroLoggerOption
func ZeroLoggerWithCaller ¶
func ZeroLoggerWithCaller() ZeroLoggerOption
func ZeroLoggerWithFields ¶
func ZeroLoggerWithFields(fields ...Field) ZeroLoggerOption
func ZeroLoggerWithLevel ¶
func ZeroLoggerWithLevel(level string) ZeroLoggerOption
func ZeroLoggerWithOutputs ¶
func ZeroLoggerWithOutputs(outputs []string) ZeroLoggerOption
func ZeroLoggerWithStackTraceInError ¶
func ZeroLoggerWithStackTraceInError() ZeroLoggerOption
Click to show internal directories.
Click to hide internal directories.