golog

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 4 Imported by: 3

README

glog

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Log(log Log)
	Format(log *Log)
}

Adapter core adapter interface

type Entry

type Entry interface {
	Log(log Log)
	WithField(key string, value interface{}) Entry
	WithFields(fields F) Entry
	WithError(err error) Entry
	WithName(name string) Entry
	Print(args ...any)
	Printf(format string, args ...any)
	Info(args ...any)
	Infof(format string, args ...any)
	Debug(args ...any)
	Debugf(format string, args ...any)
	DebugJson(data interface{})
	Warn(args ...any)
	Warnf(format string, args ...any)
	Error(args ...any)
	Errorf(format string, args ...any)
	Fatal(args ...any)
	Fatalf(format string, args ...any)
}

Entry core child logger interface

func NewEntry

func NewEntry(l Logger) Entry

type F

type F map[string]interface{}

F alias for map

type Level

type Level int

Level core level declaration

const (
	DebugLevel Level = iota - 2
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
	UnselectedLevel
)

func (Level) IsEnabled

func (l Level) IsEnabled(level Level) bool

IsEnabled check is level enabled

func (Level) String

func (l Level) String() string

String returns the string representation of the level

type Log

type Log struct {
	Level     Level
	Data      LogData
	Message   string
	Timestamp time.Time
}

Log core log interface

func NewDefaultLog

func NewDefaultLog(level Level, args ...interface{}) Log

NewDefaultLog returns new Log

func NewDefaultLogf

func NewDefaultLogf(level Level, format string, args ...interface{}) Log

NewDefaultLogf returns new Log with format args

func NewDefaultLogn

func NewDefaultLogn(level Level, name string, args ...interface{}) Log

NewDefaultLogn returns new Log with name args

func NewLogCopy

func NewLogCopy(log Log) Log

NewLogCopy returns copied Log

type LogData

type LogData struct {
	Fields   F
	Error    error
	Name     string
	WithName bool
}

LogData core log props interface

type Logger

type Logger interface {
	Log(log Log)
	WithField(key string, value interface{}) Entry
	WithFields(fields F) Entry
	WithError(err error) Entry
	WithName(name string) Entry
	Print(args ...any)
	Printf(format string, args ...any)
	Info(args ...any)
	Infon(name string, args ...any)
	Infof(format string, args ...any)
	Debug(args ...any)
	Debugn(name string, args ...any)
	Debugf(format string, args ...any)
	DebugJson(data interface{})
	Warn(args ...any)
	Warnn(name string, args ...any)
	Warnf(format string, args ...any)
	Error(args ...any)
	Errorn(name string, args ...any)
	Errorf(format string, args ...any)
	Fatal(args ...any)
	Fataln(name string, args ...any)
	Fatalf(format string, args ...any)
}

Logger core logger interface

func NewLogger

func NewLogger(adapters ...Adapter) Logger

Jump to

Keyboard shortcuts

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