pkg

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocaleTime          = "15:04:05"
	ISO8601             = "2006-01-02T15:04:05.000"
	Iso8601WithTzOffset = "2006-01-02T15:04:05.000-07:00"
	AbsoluteTime        = "15:04:05.000"
	Datetime            = "2006/01/02-15:04:05"
)
View Source
const (
	All   = "ALL"
	Trace = "TRACE"
	Debug = "DEBUG"
	Info  = "INFO"
	Error = "ERROR"
	Warn  = "WARN"
	Fatal = "FATAL"
	Off   = "OFF"
)

Variables

View Source
var (
	ColorReset   = &Color{"reset", "\033[0m"}
	ColorRed     = &Color{"red", "\033[31m"}
	ColorGreen   = &Color{"green", "\033[32m"}
	ColorYellow  = &Color{"yellow", "\033[33m"}
	ColorBlue    = &Color{"Blue", "\033[34m"}
	ColorMagenta = &Color{"magenta", "\033[35m"}
	ColorCyan    = &Color{"cyan", "\033[36m"}
)
View Source
var (
	LevelTrace = &Level{5000, Trace, *ColorBlue, 0}
	LevelDebug = &Level{10000, Debug, *ColorCyan, 1}
	LevelInfo  = &Level{20000, Info, *ColorGreen, 2}
	LevelWarn  = &Level{30000, Warn, *ColorYellow, 3}
	LevelError = &Level{40000, Error, *ColorRed, 4}
	LevelFatal = &Level{50000, Fatal, *ColorMagenta, 5}
)

Functions

func GetDateByFormat

func GetDateByFormat(format string) string

func GetLevelValueByName

func GetLevelValueByName(n string) uint

Types

type Appender

type Appender func(LoggingEvent)

type AppenderConfig

type AppenderConfig map[string]any

func (AppenderConfig) GetChannelSize

func (c AppenderConfig) GetChannelSize() int

func (AppenderConfig) GetInternalChannelSize

func (c AppenderConfig) GetInternalChannelSize() int

func (AppenderConfig) GetLayout

func (c AppenderConfig) GetLayout() LayoutConfig

func (AppenderConfig) GetType

func (c AppenderConfig) GetType() string

type AppendersConfig

type AppendersConfig map[string]AppenderConfig

type CategoriesConfig

type CategoriesConfig map[string]CategoryConfig

type CategoryConfig

type CategoryConfig map[string]any

func (CategoryConfig) GetAssociatedAppenders

func (c CategoryConfig) GetAssociatedAppenders() []string

func (CategoryConfig) GetLevelValue

func (c CategoryConfig) GetLevelValue() uint

func (CategoryConfig) GetName

func (c CategoryConfig) GetName() string

func (CategoryConfig) SetName

func (c CategoryConfig) SetName(n string)

type Color

type Color struct {
	Name string
	Code string
}

type ILogger

type ILogger interface {
	AddContext(key string, value any)
	ChangeOneContext(key string, value any)
	ChangeManyContext(c map[string]any)
	RemoveContext(key string)
	ClearContext()
	Trace(args ...any)
	Debug(args ...any)
	Info(args ...any)
	Warn(args ...any)
	Error(args ...any)
	Fatal(args ...any)
	Terminate()
}

type Layout

type Layout func(LoggingEvent) string

type LayoutConfig

type LayoutConfig map[string]any

func (LayoutConfig) GetType

func (c LayoutConfig) GetType() string

type LayoutTokens

type LayoutTokens map[string]any

type Level

type Level struct {
	Value    uint
	LevelStr string
	Color    Color
	Index    uint
}

func GetLevelByName

func GetLevelByName(n string) Level

type LoggerConfig

type LoggerConfig map[string]any

func (LoggerConfig) GetAppenders

func (lc LoggerConfig) GetAppenders() AppendersConfig

func (LoggerConfig) GetCategories

func (lc LoggerConfig) GetCategories() CategoriesConfig

type LoggingEvent

type LoggingEvent struct {
	StartTime    time.Time
	CategoryName string
	Data         []any
	Level        Level
	Context      map[string]any
	Pid          int
}

Jump to

Keyboard shortcuts

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