logging

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 24

Documentation

Index

Constants

View Source
const (
	NONE    = Level(iota) // Disable all logging
	FATAL                 // System is in severe error state and has to abort
	SEVERE                // System is in severe error state and cannot recover reliably
	ERROR                 // System is in error state but can recover and continue reliably
	WARN                  // System approaching error state, or is in a correct but undesirable state
	INFO                  // System-level events and status, in correct states
	REQUEST               // Request-level events, with request-specific rlevel
	TRACE                 // Trace detailed system execution, e.g. function entry / exit
	DEBUG                 // Debug
)
View Source
const (
	TEXTFORMATTER = LogEntryFormatter(iota)
	JSONFORMATTER
	KVFORMATTER
	UNIFORMFORMATTER
)

Variables

This section is empty.

Functions

func Debuga

func Debuga(f func() string)

func Debugf

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

func Errora

func Errora(f func() string)

func Errorf

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

func Fatala

func Fatala(f func() string)

func Fatalf

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

func Infoa

func Infoa(f func() string)

func Infof

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

func Loga

func Loga(level Level, f func() string)

func Logf

func Logf(level Level, fmt string, args ...interface{})

func NewLogger

func NewLogger(out io.Writer, lvl Level, fmtLogging LogEntryFormatter, fmtArgs ...interface{}) *goLogger

func Requesta

func Requesta(rlevel Level, f func() string)

func Requestf

func Requestf(rlevel Level, fmt string, args ...interface{})

func SetLevel

func SetLevel(level Level)

func SetLogger

func SetLogger(newLogger Logger)

func Severea

func Severea(f func() string)

func Severef

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

func Stackf

func Stackf(level Level, fmt string, args ...interface{})

func Tracea

func Tracea(f func() string)

func Tracef

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

func Warna

func Warna(f func() string)

func Warnf

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

Types

type ComponentCallback

type ComponentCallback func() string

type Level

type Level int

func LogLevel

func LogLevel() Level

func ParseLevel

func ParseLevel(name string) (level Level, ok bool)

func (Level) String

func (level Level) String() string

func (Level) UniformString

func (level Level) UniformString() string

type LogEntryFormatter

type LogEntryFormatter int

type Logger

type Logger interface {
	// Higher performance
	Loga(level Level, f func() string)
	Debuga(f func() string)
	Tracea(f func() string)
	Requesta(rlevel Level, f func() string)
	Infoa(f func() string)
	Warna(f func() string)
	Errora(f func() string)
	Severea(f func() string)
	Fatala(f func() string)

	// Printf style
	Logf(level Level, fmt string, args ...interface{})
	Debugf(fmt string, args ...interface{})
	Tracef(fmt string, args ...interface{})
	Requestf(rlevel Level, fmt string, args ...interface{})
	Infof(fmt string, args ...interface{})
	Warnf(fmt string, args ...interface{})
	Errorf(fmt string, args ...interface{})
	Severef(fmt string, args ...interface{})
	Fatalf(fmt string, args ...interface{})

	/*
		These APIs control the logging level
	*/
	SetLevel(Level) // Set the logging level
	Level() Level   // Get the current logging level
}

Logger provides a common interface for logging libraries

Jump to

Keyboard shortcuts

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