log

package
v0.0.0-...-cbbc4cb Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QUIET   = -1
	DEFAULT = 0
	DEBUG   = 1
	TRACE   = 2
)

Variables

View Source
var Error *log.Logger
View Source
var Info *log.Logger
View Source
var Output *os.File
View Source
var Warning *log.Logger

Functions

func ApiLogger

func ApiLogger(logLevel int) func(http.Handler) http.Handler

func ErrTrace

func ErrTrace(err error, extras ...string)

func GetLogLevel

func GetLogLevel() int

func SetLogLevel

func SetLogLevel(newLevel int, outputPath string)

func ShowErr

func ShowErr(err error, extras ...string)

func TraceCaller

func TraceCaller(skip int, format string, v ...any)

Types

type FuncLogger

type FuncLogger interface {
	Logger

	// Func allows for a logger callback, that can be optionally disabled based on the log level.
	// This way, expensive logging operations can be avoided if the log level is too low by putting them
	// inside the function.
	Func(func(Logger))
}
var Debug FuncLogger = emptyLogger{}
var Trace FuncLogger = emptyLogger{}

type Logger

type Logger interface {
	Printf(format string, v ...any)
	Println(v ...any)
	Printfn(skip int, format string, v ...any)
	Printlnn(skip int, v ...any)
}
var ErrorCatcher Logger

func NewLogger

func NewLogger(prefix string, skip int) Logger

type StackError

type StackError interface {
	Error() string
	Stack() string
	Errorln() string
}

Jump to

Keyboard shortcuts

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