log

package
v0.49.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 79

Documentation

Index

Constants

View Source
const Debug = Level("debug")

Info is sets level=info in the log output

View Source
const Error = Level("error")

Error sets level=error in the log output

View Source
const Fatal = Level("fatal")

Fatal sets level=fatal in the log output

View Source
const Info = Level("info")

Info is sets level=info in the log output

View Source
const StackTrace = st("stacktrace")
View Source
const Warn = Level("warn")

Info is sets level=warn in the log output

Variables

This section is empty.

Functions

func NewBufferLogger

func NewBufferLogger() (*BufferedLogger, Logger)

Types

type BufferedLogger added in v0.45.1

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

func (*BufferedLogger) Reset added in v0.45.1

func (bl *BufferedLogger) Reset()

func (*BufferedLogger) String added in v0.45.1

func (bl *BufferedLogger) String() string

func (*BufferedLogger) Write added in v0.45.1

func (bl *BufferedLogger) Write(p []byte) (n int, err error)

type Context

type Context interface {
	Context() map[string]Valuer
}

type Fields

type Fields map[string]Valuer

func (Fields) Context

func (f Fields) Context() map[string]Valuer

type Level

type Level string

Level just wraps a string to be able to add Context specific to log levels

func (Level) Context

func (l Level) Context() map[string]Valuer

Context returns the map that states that key value of `level={{l}}`

type LoggedError added in v0.13.0

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

func (LoggedError) Err added in v0.13.0

func (l LoggedError) Err() error

func (LoggedError) Nil added in v0.18.1

func (l LoggedError) Nil() error

type Logger

type Logger interface {
	Set(key string, value Valuer) Logger
	With(ctxs ...Context) Logger
	Details() map[string]interface{}

	Debug() Logger
	Info() Logger
	Warn() Logger
	Error() Logger
	Fatal() Logger

	Log(message string)
	Logf(format string, args ...interface{})
	Send()

	LogError(error error) LoggedError
	LogErrorf(format string, args ...interface{}) LoggedError
}

func NewDefaultLogger

func NewDefaultLogger() Logger

func NewJSONLogger

func NewJSONLogger() Logger

func NewLogFmtLogger added in v0.45.0

func NewLogFmtLogger() Logger

func NewLogger

func NewLogger(writer log.Logger) Logger

func NewNopLogger

func NewNopLogger() Logger

func NewTestLogger added in v0.30.0

func NewTestLogger() Logger

type Valuer added in v0.15.0

type Valuer interface {
	// contains filtered or unexported methods
}

Valuer is an interface to deal with typing problems of just having an interface{} as the acceptable parameters Go-kit logging has a failure case if you attempt to throw any values into it. This is a way to guard our developers from having to worry about error cases of the lower logging framework.

func Bool added in v0.15.0

func Bool(b bool) Valuer

func ByteBase64 added in v0.15.0

func ByteBase64(b []byte) Valuer

func ByteString added in v0.15.0

func ByteString(b []byte) Valuer

func Float32 added in v0.23.0

func Float32(f float32) Valuer

func Float64 added in v0.15.0

func Float64(f float64) Valuer

func Int added in v0.15.0

func Int(i int) Valuer

func Int64 added in v0.24.0

func Int64(i int64) Valuer

func Int64OrNil added in v0.34.0

func Int64OrNil(i *int64) Valuer

func String added in v0.15.0

func String(s string) Valuer

func StringOrNil added in v0.15.4

func StringOrNil(s *string) Valuer

func Stringer added in v0.15.1

func Stringer(s fmt.Stringer) Valuer

func Strings added in v0.15.3

func Strings(vals []string) Valuer

func Time added in v0.15.0

func Time(t time.Time) Valuer

func TimeDuration added in v0.15.0

func TimeDuration(d time.Duration) Valuer

func TimeFormatted added in v0.15.0

func TimeFormatted(t time.Time, format string) Valuer

func TimeOrNil added in v0.18.1

func TimeOrNil(t *time.Time) Valuer

func Uint32 added in v0.23.0

func Uint32(i uint32) Valuer

func Uint64 added in v0.23.0

func Uint64(i uint64) Valuer

Jump to

Keyboard shortcuts

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