log

package
v0.0.0-...-099d0cb Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidFormatStrings = []string{
	string(FormatJSON),
	string(FormatText),
}
View Source
var WithField,
	WithFields = logger.WithField,
	logger.WithFields

Functions

func Init

func Init(
	logFormat Format,
	logLevel Level,
)

Types

type Format

type Format string
const (
	FormatJSON Format = "json"
	FormatText Format = "text"
)

type Level

type Level string
const (
	LevelTrace Level = "trace"
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
)

type Log

type Log func(l ...interface{})

Log defines the function signature of the logger

var Trace,

	Debug,

	Info,

	Warn,

	Error,
	Print Log = logger.Trace,
	logger.Debug,
	logger.Info,
	logger.Warn,
	logger.Error,
	func(l ...interface{}) {
		fmt.Println(l...)
	}

Trace logs at the Trace level

type Logf

type Logf func(s string, l ...interface{})

Log defines the function signature of the logger when called with format parameters

var Tracef,

	Debugf,

	Infof,

	Warnf,

	Errorf,
	Printf Logf = logger.Tracef,
	logger.Debugf,
	logger.Infof,
	logger.Warnf,
	logger.Errorf,
	func(s string, l ...interface{}) {
		fmt.Printf(s, l...)
		fmt.Printf("\n")
	}

Tracef logs at the trace level with formatting

type Logger

type Logger interface {
	Trace(...interface{})
	Tracef(string, ...interface{})
	Debug(...interface{})
	Debugf(string, ...interface{})
	Info(...interface{})
	Infof(string, ...interface{})
	Warn(...interface{})
	Warnf(string, ...interface{})
	Error(...interface{})
	Errorf(string, ...interface{})
}

Jump to

Keyboard shortcuts

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