xlog

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2019 License: BSD-3-Clause, BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorLevel = Level(iota)
	InfoLevel
	DebugLevel
)

Variables

This section is empty.

Functions

func Debugf added in v0.0.22

func Debugf(ctx context.Context, format string, args ...interface{})

func Errorf added in v0.0.22

func Errorf(ctx context.Context, format string, args ...interface{})

func From added in v0.0.22

func From(ctx context.Context) logger

func Infof added in v0.0.22

func Infof(ctx context.Context, format string, args ...interface{})

func With added in v0.0.22

func With(ctx context.Context, sink Sink) context.Context

Types

type Level

type Level int

Level indicates the severity of the logging message.

type Sink

type Sink interface {
	Log(ctx context.Context, level Level, message string)
}

Sink is the interface to something that consumes logging messages. This can be implemented and then registered with a context to control the destination or formatting of logging.

type StdSink

type StdSink struct{}

StdSink is a Sink that writes to the standard log package.

func (StdSink) Log

func (StdSink) Log(ctx context.Context, level Level, message string)

Log implements Sink for the StdSink. It writes the message using log.Print with a level based prefix.

Jump to

Keyboard shortcuts

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