loggee

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Activity

func Activity(ctx context.Context, fn ActivityFunc) error

Activity log within th context of the activity

func Debug

func Debug(msg string)

Debug writes a debug message

func Debugf

func Debugf(fmt string, args ...interface{})

Debugf writes a formated debug message

func Error

func Error(msg string)

Error writes an error message

func Errorf

func Errorf(fmt string, args ...interface{})

Errorf writes a formated error message

func Fatal

func Fatal(msg string)

Fatal writes a fatal error message and exits

func Fatalf

func Fatalf(fmt string, args ...interface{})

Fatalf writes a formated fatal message and exits

func Info

func Info(msg string)

Info writes a info message

func Infof

func Infof(fmt string, args ...interface{})

Infof writes a formated info message

func SetLogger

func SetLogger(logger Logger)

SetLogger sets the logger

func Warn

func Warn(msg string)

Warn writes a warning message

func Warnf

func Warnf(fmt string, args ...interface{})

Warnf writes a formated warn message

Types

type ActivityFunc

type ActivityFunc func(context.Context) error

type Entry

type Entry interface {
	WithFields(Fielder) Entry
	WithField(string, interface{}) Entry
	WithDuration(time.Duration) Entry
	WithError(error) Entry
	Debug(string)
	Info(string)
	Warn(string)
	Error(string)
	Fatal(string)
	Debugf(string, ...interface{})
	Infof(string, ...interface{})
	Warnf(string, ...interface{})
	Errorf(string, ...interface{})
	Fatalf(string, ...interface{})
}

func WithDuration

func WithDuration(d time.Duration) Entry

WithDuration adds a time t an entry

func WithError

func WithError(e error) Entry

WithError adds an error to the entry

func WithField

func WithField(key string, value interface{}) Entry

WithField adds a field to an Entry

func WithFields

func WithFields(f Fielder) Entry

WithFields adds fields to a log entry

type Fielder

type Fielder interface {
	Fields() Fields
}

Fielder is an interface for providing fields to custom types.

type Fields

type Fields map[string]interface{}

Fields represents a map of entry level data used for structured logging.

func (Fields) Fields

func (f Fields) Fields() Fields

Fields implements Fielder.

func (Fields) Get

func (f Fields) Get(name string) interface{}

Get field value by name.

type Logger

type Logger interface {

	// Entry implements the main logging interface
	Entry

	// Activity log within th context of the activity
	Activity(ctx context.Context, fn ActivityFunc) error
}

Logger is the generic interface for all loggers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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