log

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2018 License: MIT Imports: 2 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Null is the null Logger instance.
	Null = &nullLogger{}
)

Functions

func Debug

func Debug(ctx context.Context, msg string, pairs ...interface{})

Debug logs a debug message.

func Error

func Error(ctx context.Context, msg string, pairs ...interface{})

Error logs an error message.

func Fatal

func Fatal(ctx context.Context, msg string, pairs ...interface{})

Fatal is equivalent to Error() followed by a call to os.Exit(1).

func Info

func Info(ctx context.Context, msg string, pairs ...interface{})

Info logs an informational message.

func WithLogger

func WithLogger(ctx context.Context, logger Logger) context.Context

WithLogger sets Logger in the context.

Types

type Logger

type Logger interface {
	// Debug logs a debug message.
	Debug(msg string, ctx ...interface{})
	// Info logs an informational message.
	Info(msg string, ctx ...interface{})
	// Error logs an error message.
	Error(msg string, ctx ...interface{})
}

Logger represents an abstract logging object.

func FromContext

func FromContext(ctx context.Context) (Logger, bool)

FromContext returns the instance Logger in the context.

Jump to

Keyboard shortcuts

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