log

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// Default means the log entry has no assigned severity level.
	Default = Severity(0)
	// Debug means debug or trace information.
	Debug = Severity(100)
	// Info means routine information, such as ongoing status or performance.
	Info = Severity(200)
	// Notice means normal but significant events, such as start up, shut down, or configuration.
	Notice = Severity(300)
	// Warning means events that might cause problems.
	Warning = Severity(400)
	// Error means events that are likely to cause problems.
	Error = Severity(500)
	// Critical means events that cause more severe problems or brief outages.
	Critical = Severity(600)
	// Alert means a person must take an action immediately.
	Alert = Severity(700)
	// Emergency means one or more systems are unusable.
	Emergency = Severity(800)
)

Variables

This section is empty.

Functions

func WithInterface added in v0.0.7

func WithInterface(parent context.Context, i Interface) context.Context

WithInterface returns a new context with i

Types

type Interface

type Interface interface {
	LogPayload(ctx context.Context, severity Severity, payload interface{})
	Log(ctx context.Context, severity Severity, args ...interface{})
	Logf(ctx context.Context, severity Severity, fmt string, args ...interface{})
	LogErr(ctx context.Context, severity Severity, err error) error
}

func ResolveInterface added in v0.0.7

func ResolveInterface(ctx context.Context) (Interface, bool)

ResolveInterface returns the interface that was by a call to WithInterface on ctx

type Severity

type Severity int

func (Severity) Defined added in v0.0.7

func (s Severity) Defined() bool

Defined returns true if s holds a defined value.

func (Severity) Next added in v0.0.7

func (s Severity) Next() Severity

Next returns the next defined Severity. If s is not defined, then Next returns the first defined value. Next() can be used to loop through all values of an enum.

s := Severity(0)
for {
	fmt.Println(s)
	s = s.Next()
	if s == Severity(0) {
		break
	}
}

The exact order that values are returned when looping should not be relied upon.

func (*Severity) Scan added in v0.0.7

func (s *Severity) Scan(scanState fmt.ScanState, verb rune) error

Scan implements fmt.Scanner. Use fmt.Scan() to parse strings into Severity values

func (Severity) String

func (s Severity) String() string

String implements fmt.Stringer. If !s.Defined(), then a generated string is returned based on s's value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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