Documentation ¶
Index ¶
- Constants
- func AddOutput(name string, cfg *OutputConfig) error
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugw(msg string, kvs ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorw(msg string, kvs ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalw(msg string, kvs ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infow(msg string, kvs ...interface{})
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Panicw(msg string, kvs ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func RegisterOutput(name string, constructor Constructor) error
- func SetLevel(level Level)
- func Sync() error
- func Use(logger Logger)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warnw(msg string, kvs ...interface{})
- func WithContext(ctx context.Context, logger Logger) context.Context
- type Config
- type Constructor
- type EncoderConfig
- type Level
- type Logger
- type Output
- type OutputConfig
Constants ¶
View Source
const ( JSON = "json" Text = "text" )
View Source
const (
Console = "console"
)
Variables ¶
This section is empty.
Functions ¶
func AddOutput ¶
func AddOutput(name string, cfg *OutputConfig) error
func RegisterOutput ¶
func RegisterOutput(name string, constructor Constructor) error
Types ¶
type Config ¶
type Config struct { Level string `json:"level,omitempty" yaml:"level"` Name string `json:"name" yaml:"name"` CallerDisabled bool `json:"callerDisabled,omitempty" yaml:"callerDisabled"` StacktraceEnabled bool `json:"stacktraceEnabled,omitempty" yaml:"stacktraceEnabled"` Encoding string `json:"encoding,omitempty" yaml:"encoding"` EncoderConfig *EncoderConfig `json:"encoderConfig,omitempty" yaml:"encoderConfig"` InitialFields map[string]interface{} `json:"initialFields,omitempty" yaml:"initialFields"` Output map[string]*OutputConfig `json:"output" yaml:"output"` }
func DefaultConfig ¶
func DefaultConfig() *Config
type Constructor ¶
type Constructor func(cfg *OutputConfig) (Output, error)
type EncoderConfig ¶
type EncoderConfig struct { ColorEnabled bool `json:"colorEnabled" yaml:"colorEnabled"` MessageKey string `json:"messageKey,omitempty" yaml:"messageKey"` LevelKey string `json:"levelKey,omitempty" yaml:"levelKey"` TimeKey string `json:"timeKey,omitempty" yaml:"timeKey"` NameKey string `json:"nameKey,omitempty" yaml:"nameKey"` CallerKey string `json:"callerKey,omitempty" yaml:"callerKey"` StacktraceKey string `json:"stacktraceKey,omitempty" yaml:"stacktraceKey"` LineEnding string `json:"lineEnding,omitempty" yaml:"lineEnding"` LevelEncoder string `json:"levelEncoder,omitempty" yaml:"levelEncoder"` TimeEncoder string `json:"timeEncoder,omitempty" yaml:"timeEncoder"` DurationEncoder string `json:"durationEncoder,omitempty" yaml:"durationEncoder"` CallerEncoder string `json:"callerEncoder,omitempty" yaml:"callerEncoder"` NameEncoder string `json:"nameEncoder,omitempty" yaml:"nameEncoder"` }
func DefaultEncoderConfig ¶
func DefaultEncoderConfig() *EncoderConfig
type Logger ¶
type Logger interface { SetLevel(levelStr Level) Sync() error // new loggers Named(name string) Logger With(kvs ...interface{}) Logger AddCallerSkip(skip int) Logger AddOutput(name string, cfg *OutputConfig) error // elog writers Debug(args ...interface{}) Info(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) Panic(args ...interface{}) // elog key values Debugw(msg string, kvs ...interface{}) Infow(msg string, kvs ...interface{}) Warnw(msg string, kvs ...interface{}) Errorw(msg string, kvs ...interface{}) Fatalw(msg string, kvs ...interface{}) Panicw(msg string, kvs ...interface{}) // printf-like Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Panicf(format string, args ...interface{}) Printf(format string, args ...interface{}) Println(args ...interface{}) }
Logger logger.yaml interface
func AddCallerSkip ¶
func FromContext ¶
type OutputConfig ¶
type OutputConfig struct { Enabled bool `json:"enabled,omitempty" yaml:"enabled"` Level string `json:"level,omitempty" yaml:"level"` Encoding string `json:"encoding,omitempty" yaml:"encoding"` EncoderConfig *EncoderConfig `json:"encoderConfig,omitempty" yaml:"encoderConfig"` Params map[string]interface{} `json:"parameters,omitempty" yaml:"parameters"` }
func DefaultConsoleConfig ¶
func DefaultConsoleConfig() *OutputConfig
Source Files ¶
Click to show internal directories.
Click to hide internal directories.