logging

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MaxStackSize int = 5

Variables

View Source
var (
	MaxFileSize int64 = 5096000
)

Functions

func SetWorkplace

func SetWorkplace(plant string, wp string) attrSetter

Types

type CLOpt

type CLOpt func(*CommonLog) error

func WithDetails

func WithDetails(details map[string]any) CLOpt

func WithError

func WithError[E CommonError](cerr E, errOpts ...any) CLOpt

func WithOnumPlant

func WithOnumPlant[on oNumber](onum on, plant string) CLOpt

func WithUnstructuredDetails

func WithUnstructuredDetails(d string) CLOpt

type CommonError

type CommonError interface {
	MapableError
	ConfigurableError
}

type CommonLog

type CommonLog struct {
	Wonum               string         `json:"wo"`
	Plant               string         `json:"plant"`
	Details             map[string]any `json:"details"`
	UnstructuredDetails string         `json:"unstructured_details"`
	Error               map[string]any `json:"err"`
	// contains filtered or unexported fields
}

func NewClog

func NewClog(opts ...CLOpt) CommonLog

type ConfigurableError

type ConfigurableError interface {
	ExtendOpts(opts ...any) error
}

type DCSlogger

type DCSlogger struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewDCSlogger

func NewDCSlogger(name string, lc LogConfiguration, slogAttrs ...attrSetter) *DCSlogger

TODO: For gradeab we should be able to spawn multiple loggers

func Provide

func Provide() *DCSlogger

func (*DCSlogger) Debug

func (l *DCSlogger) Debug(msg string, details ...any)

func (*DCSlogger) Error

func (l *DCSlogger) Error(msg string, err ...any)

func (*DCSlogger) GetLogs

func (l *DCSlogger) GetLogs(days int, sev string) LogReport

func (*DCSlogger) Info

func (l *DCSlogger) Info(msg string, details ...any)

func (*DCSlogger) Name

func (l *DCSlogger) Name() string

func (*DCSlogger) Warn

func (l *DCSlogger) Warn(msg string, err ...any)

type LogConfiguration

type LogConfiguration interface {
	MinLevel() slog.Level
	Dir() string
	MaxFileSize() int
}

type LogRecord

type LogRecord map[string]any

NOTE: Maybe this should be an interface with a JSONable requirement?

type LogReport

type LogReport map[civil.Date]map[string][]LogRecord

TODO: A log reporter should be able to report from multiple workplaces for gradeab

type MapableError

type MapableError interface {
	error
	boiler.Mapable
}

Jump to

Keyboard shortcuts

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