stdlog

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int
const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarning
	LevelError
	LevelFatal
)

func (Level) String

func (l Level) String() string

type Logger

type Logger[T any] interface {
	// Named returns a new logger with its previous name followed by a dot,
	// followed by the provided name.
	Named(name string) Logger[T]
	SetLevel(level Level)

	Debug(msg string, keysAndValues ...T)
	Info(msg string, keysAndValues ...T)
	Warning(msg string, keysAndValues ...T)
	Error(err error, msg string, keysAndValues ...T)
	Fatal(msg string, keysAndValues ...T)
	FatalError(err error, msg string, keysAndValues ...T)
}

func NewSTD

func NewSTD(writer io.Writer) Logger[any]

type StdLoggerOut

type StdLoggerOut struct {
	// contains filtered or unexported fields
}

func (*StdLoggerOut) Debug

func (s *StdLoggerOut) Debug(msg string, kvs ...any)

func (*StdLoggerOut) Do

func (s *StdLoggerOut) Do(ts, caller, bt, msg string, level Level, err error, kvs ...any)

func (*StdLoggerOut) Error

func (s *StdLoggerOut) Error(err error, msg string, kvs ...any)

func (*StdLoggerOut) Fatal

func (s *StdLoggerOut) Fatal(msg string, kvs ...any)

func (*StdLoggerOut) FatalError

func (s *StdLoggerOut) FatalError(err error, msg string, kvs ...any)

func (*StdLoggerOut) Info

func (s *StdLoggerOut) Info(msg string, kvs ...any)

func (*StdLoggerOut) Named

func (s *StdLoggerOut) Named(name string) Logger[any]

func (*StdLoggerOut) SetLevel

func (s *StdLoggerOut) SetLevel(level Level)

func (*StdLoggerOut) Warning

func (s *StdLoggerOut) Warning(msg string, kvs ...any)

Jump to

Keyboard shortcuts

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