logger

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogColorMap = map[LogLevel]Color{
	LogLevelError: LogColorRed,
	LogLevelWarn:  LogColorYellow,
	LogLevelInfo:  LogColorCyan,
	LogLevelDebug: LogColorWhite,
}

Functions

This section is empty.

Types

type Color

type Color uint8

Color represents a text color.

const (
	LogColorBlack Color = iota + 30
	LogColorRed
	LogColorGreen
	LogColorYellow
	LogColorBlue
	LogColorMagenta
	LogColorCyan
	LogColorWhite
)

func (Color) Add

func (c Color) Add(s string) string

Add adds the coloring to the given string.

type ILogger

type ILogger interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	DebugW(message string, keysAndValues ...interface{})
	DebugS(message string, fields LogField)
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	InfoW(message string, keysAndValues ...interface{})
	InfoS(message string, fields LogField)
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	WarnW(message string, keysAndValues ...interface{})
	WarnS(message string, fields LogField)
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	ErrorW(message string, keysAndValues ...interface{})
	ErrorS(message string, fields LogField)
	WithPrefix(prefix string) ILogger
	SetLogLevel(level LogLevel)
}

type LogField

type LogField map[string]interface{}

func (LogField) Flatten

func (f LogField) Flatten() []interface{}

type LogLevel

type LogLevel uint32
const (
	LogLevelError LogLevel = iota
	LogLevelWarn
	LogLevelInfo
	LogLevelDebug
)

type LogMessage

type LogMessage struct {
	Timestamp int64
	Level     LogLevel
	Prefix    string
	Message   string
	Data      map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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