logging

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorBlack = iota + 30
	ColorRed
	ColorGreen
	ColorYellow
	ColorBlue
	ColorMagenta
	ColorCyan
	ColorWhite
)

Variables

This section is empty.

Functions

func ColorSeq

func ColorSeq(color color) string

func ColorSeqBold

func ColorSeqBold(color color) string

func GetFileAndLine

func GetFileAndLine() string

func Log

func Log(lvl Level, buf *strings.Builder, format *string, args ...interface{})

func LoggingMiddleware added in v0.0.13

func LoggingMiddleware() func(http.Handler) http.Handler

Types

type Formatter

type Formatter interface {
	Log(Level, int, *Record) error
}

type Level

type Level int
const (
	CRITICAL Level = iota
	ERROR
	WARNING
	INFO
	DEBUG
)

func (Level) String

func (p Level) String() string

type Logger

type Logger struct {
	Formatter Formatter
}

func (*Logger) Log

func (l *Logger) Log(level Level, buf *strings.Builder, rec *Record)

type Record

type Record struct {
	Time  time.Time
	Level Level

	Args []interface{}
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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