applog

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close flushes remaining logs and stops the background goroutine.

func Debug

func Debug(component, msg string, keyvals ...any)

Debug logs at debug level.

func Error

func Error(component, msg string, keyvals ...any)

Error logs at error level.

func Errorf

func Errorf(component, format string, args ...any)

Errorf logs at error level with format string.

func Info

func Info(component, msg string, keyvals ...any)

Info logs at info level.

func Infof

func Infof(component, format string, args ...any)

Infof logs at info level with format string.

func Init

func Init(store LogStore)

Init initializes the global logger with a store backend.

func Warn

func Warn(component, msg string, keyvals ...any)

Warn logs at warn level.

func Warnf

func Warnf(component, format string, args ...any)

Warnf logs at warn level with format string.

Types

type LogRow

type LogRow struct {
	Timestamp time.Time `json:"timestamp"`
	Level     string    `json:"level"`
	Component string    `json:"component"`
	Message   string    `json:"message"`
	Context   string    `json:"context,omitempty"`
}

LogRow represents a single log entry.

type LogStore

type LogStore interface {
	InsertLogs(ctx context.Context, logs []LogRow) error
}

LogStore is the interface for persisting logs.

type Logger

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

Logger buffers log rows and flushes them to a LogStore.

Jump to

Keyboard shortcuts

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