logger

package
v0.0.0-...-7edcfce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFields

func AppendFields(f Fields, fields ...Fields)

Types

type Fields

type Fields = map[string]interface{}

func AppendFieldsNew

func AppendFieldsNew(f Fields, fields ...Fields) Fields

func FieldsWithError

func FieldsWithError(err error, f ...Fields) Fields

func NewFields

func NewFields(fields ...Fields) Fields

type Level

type Level uint32
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel Level = iota
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

func (Level) String

func (level Level) String() string

type Logger

type Logger interface {
	Log(level Level, message string, fields ...Fields)

	Error(message string, err error, fields ...Fields) error
	ErrorNative(err error, fields ...Fields)
	ErrorMessage(message string, fields ...Fields)

	Warn(message string, fields ...Fields)
	Debug(message string, fields ...Fields)
	Info(message string, fields ...Fields)
	Trace(message string, fields ...Fields)
	Fatal(message string, err error, fields ...Fields) error

	ErrorRaw(...interface{})

	Native() interface{}

	PushFatalStack(message string, err error, fields ...Fields) error
	CheckFatalStack(logger Logger, message ...string) bool

	DumpRequests() bool

	SetLevel(level Level)
	GetLevel() Level
}

type LoggerBase

type LoggerBase struct {
	// contains filtered or unexported fields
}

func (*LoggerBase) CheckFatalStack

func (l *LoggerBase) CheckFatalStack(logger Logger, message ...string) bool

func (*LoggerBase) Init

func (l *LoggerBase) Init()

func (*LoggerBase) PushFatalStack

func (l *LoggerBase) PushFatalStack(message string, err error, fields ...Fields) error

type ProxyLogger

type ProxyLogger struct {
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy(log Logger, fields ...Fields) *ProxyLogger

func (*ProxyLogger) CheckFatalStack

func (p *ProxyLogger) CheckFatalStack(logger Logger, message ...string) bool

func (*ProxyLogger) Debug

func (p *ProxyLogger) Debug(message string, fields ...Fields)

func (*ProxyLogger) DumpRequests

func (p *ProxyLogger) DumpRequests() bool

func (*ProxyLogger) Error

func (p *ProxyLogger) Error(message string, err error, fields ...Fields) error

func (*ProxyLogger) ErrorMessage

func (p *ProxyLogger) ErrorMessage(message string, fields ...Fields)

func (*ProxyLogger) ErrorNative

func (p *ProxyLogger) ErrorNative(err error, fields ...Fields)

func (*ProxyLogger) ErrorRaw

func (p *ProxyLogger) ErrorRaw(data ...interface{})

func (*ProxyLogger) Fatal

func (p *ProxyLogger) Fatal(message string, err error, fields ...Fields) error

func (*ProxyLogger) GetLevel

func (p *ProxyLogger) GetLevel() Level

func (*ProxyLogger) Info

func (p *ProxyLogger) Info(message string, fields ...Fields)

func (*ProxyLogger) Log

func (p *ProxyLogger) Log(level Level, message string, fields ...Fields)

func (*ProxyLogger) Native

func (p *ProxyLogger) Native() interface{}

func (*ProxyLogger) NextLogger

func (p *ProxyLogger) NextLogger() Logger

func (*ProxyLogger) PushFatalStack

func (p *ProxyLogger) PushFatalStack(message string, err error, fields ...Fields) error

func (*ProxyLogger) Reset

func (p *ProxyLogger) Reset()

func (*ProxyLogger) SetLevel

func (p *ProxyLogger) SetLevel(level Level)

func (*ProxyLogger) SetNextLogger

func (p *ProxyLogger) SetNextLogger(logger Logger)

func (*ProxyLogger) SetStaticField

func (p *ProxyLogger) SetStaticField(name string, value interface{})

func (*ProxyLogger) StaticFields

func (p *ProxyLogger) StaticFields() Fields

func (*ProxyLogger) Trace

func (p *ProxyLogger) Trace(message string, fields ...Fields)

func (*ProxyLogger) UnsetStaticField

func (p *ProxyLogger) UnsetStaticField(name string)

func (*ProxyLogger) Warn

func (p *ProxyLogger) Warn(message string, fields ...Fields)

type TeeLogger

type TeeLogger struct {
	// contains filtered or unexported fields
}

func NewTee

func NewTee(loggers ...Logger) *TeeLogger

func (*TeeLogger) CheckFatalStack

func (t *TeeLogger) CheckFatalStack(logger Logger, message ...string) bool

func (*TeeLogger) Debug

func (t *TeeLogger) Debug(message string, fields ...Fields)

func (*TeeLogger) DumpRequests

func (t *TeeLogger) DumpRequests() bool

func (*TeeLogger) Error

func (t *TeeLogger) Error(message string, err error, fields ...Fields) error

func (*TeeLogger) ErrorMessage

func (t *TeeLogger) ErrorMessage(message string, fields ...Fields)

func (*TeeLogger) ErrorNative

func (t *TeeLogger) ErrorNative(err error, fields ...Fields)

func (*TeeLogger) ErrorRaw

func (t *TeeLogger) ErrorRaw(data ...interface{})

func (*TeeLogger) Fatal

func (t *TeeLogger) Fatal(message string, err error, fields ...Fields) error

func (*TeeLogger) GetLevel

func (t *TeeLogger) GetLevel() Level

func (*TeeLogger) Info

func (t *TeeLogger) Info(message string, fields ...Fields)

func (*TeeLogger) Log

func (t *TeeLogger) Log(level Level, message string, fields ...Fields)

func (*TeeLogger) Native

func (t *TeeLogger) Native() interface{}

func (*TeeLogger) PushFatalStack

func (t *TeeLogger) PushFatalStack(message string, err error, fields ...Fields) error

func (*TeeLogger) SetLevel

func (t *TeeLogger) SetLevel(level Level)

func (*TeeLogger) Trace

func (t *TeeLogger) Trace(message string, fields ...Fields)

func (*TeeLogger) Warn

func (t *TeeLogger) Warn(message string, fields ...Fields)

type WithLogger

type WithLogger interface {
	Logger() Logger
	SetLogger(logger Logger)
}

type WithLoggerBase

type WithLoggerBase struct {
	// contains filtered or unexported fields
}

func (*WithLoggerBase) Init

func (w *WithLoggerBase) Init(logger Logger)

func (*WithLoggerBase) Logger

func (w *WithLoggerBase) Logger() Logger

func (*WithLoggerBase) SetLogger

func (w *WithLoggerBase) SetLogger(logger Logger)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL