log

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Key      string
	Type     FieldType
	String   string
	Int      int
	Duration time.Duration
	Error    error
}

Field type

func Duration

func Duration(key string, value time.Duration) Field

Duration field value to time.Durations

func Error

func Error(err error) Field

Error field value for errors

func Int

func Int(key string, value int) Field

Int field value for ints

func String

func String(key string, value string) Field

String field value for strings

type FieldType

type FieldType int

FieldType loggable field types

const (
	StringType FieldType = iota
	IntType
	DurationType
	ErrorType
)

Loggable field types

type Logger

type Logger interface {
	Trace(msg string, fields ...Field)
	Debug(msg string, fields ...Field)
	Info(msg string, fields ...Field)
	Warn(msg string, fields ...Field)
	Error(msg string, fields ...Field)
	Sub(fields ...Field) Logger
}

Logger interface

var DefaultLogger Logger = NewNopLogger()

DefaultLogger is set to a Nop logger

You may reassign this if you wish to avoid having to pass in With*Logger(yourLogger) options into many of the constructors to set a custom logger

func NewNopLogger

func NewNopLogger() Logger

NewNopLogger returns a logger that logs to the void

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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