logging

package
v0.0.0-...-3611cfd Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields map[string]interface{}

Fields are used to add additional context to your log message

func MergeFields

func MergeFields(a, b Fields) Fields

MergeFields creates a new Fields set by merging a and b.

func (Fields) Dupe

func (fields Fields) Dupe() Fields

Dupe makes a copy of the fields

func (Fields) WithError

func (fields Fields) WithError(err error) Fields

WithError is used to add the full error string to the context. This is useful especially with the obserr package

type Logger

type Logger interface {
	Debug(message string, fields Fields)
	Info(message string, fields Fields)
	Warn(message string, fields Fields)
	Error(message string, fields Fields)
	Critical(message string, fields Fields)

	IsDebug() bool
	IsInfo() bool
	IsWarn() bool
	IsError() bool
	IsCritical() bool

	Named(name string) Logger
}

Logger is the interface to logging It is simlar to standard logger but supports fields. An implementation of logger can be used by flight recorder for the logging.

var Null Logger = nullLogger(struct{}{})

Null is the null implementation of logger.

func New

func New(syslogLevel, fileLevel, filePath, format string) Logger

New creates a new logger, pass in the log levels, and file specifications to create one

Jump to

Keyboard shortcuts

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