log

package
v1.0.34 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StackDriver  = "stack"
	SingleDriver = "single"
	DailyDriver  = "daily"
	CustomDriver = "custom"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	Context() context.Context
	Level() Level
	Time() time.Time
	Message() string
	// DEPRECATED: use Level()
	GetLevel() Level
	// DEPRECATED: use Time()
	GetTime() time.Time
	// DEPRECATED: use Message()
	GetMessage() string
}

type Hook

type Hook interface {
	// Levels monitoring level
	Levels() []Level
	// Fire execute logic when trigger
	Fire(Entry) error
}

type Level

type Level logrus.Level
const (
	PanicLevel Level = iota
	FatalLevel
	ErrorLevel
	WarningLevel
	InfoLevel
	DebugLevel
)

func ParseLevel

func ParseLevel(lvl string) (Level, error)

ParseLevel takes a string level and returns the Logrus log level constant.

func (Level) MarshalText

func (level Level) MarshalText() ([]byte, error)

func (Level) String

func (level Level) String() string

Convert the Level to a string. E.g. PanicLevel becomes "panic".

func (*Level) UnmarshalText

func (level *Level) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Log

type Log interface {
	WithContext(ctx context.Context) Writer
	Writer
}

type Logger

type Logger interface {
	// Handle pass channel config path here
	Handle(channel string) (Hook, error)
}

type Writer added in v1.0.17

type Writer interface {
	Debug(args ...any)
	Debugf(format string, args ...any)
	Info(args ...any)
	Infof(format string, args ...any)
	Warning(args ...any)
	Warningf(format string, args ...any)
	Error(args ...any)
	Errorf(format string, args ...any)
	Fatal(args ...any)
	Fatalf(format string, args ...any)
	Panic(args ...any)
	Panicf(format string, args ...any)
}

Jump to

Keyboard shortcuts

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