logger

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package logger provides logging functionality with execution isolation. Each execution maintains a separate log stream identified by executionID.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogEntry

type LogEntry struct {
	ExecutionID string
	Level       LogLevel
	Message     string
	Timestamp   int64
}

LogEntry represents a single log entry

type LogLevel

type LogLevel int

LogLevel represents the severity level of a log entry

const (
	Info LogLevel = iota
	Debug
	Warn
	Error
)

func (LogLevel) String

func (l LogLevel) String() string

String returns the string representation of a LogLevel

type Logger

type Logger interface {
	Log(executionID string, level LogLevel, message string)
	Info(executionID string, message string)
	Debug(executionID string, message string)
	Warn(executionID string, message string)
	Error(executionID string, message string)
	Entries(executionID string) []LogEntry
	EntriesPaginated(executionID string, limit, offset int) ([]LogEntry, int64)
}

Logger is an interface for logging operations executionID is used to isolate logs for each function execution

type MemoryLogger

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

MemoryLogger is an in-memory implementation of Logger

func NewMemoryLogger

func NewMemoryLogger() *MemoryLogger

NewMemoryLogger creates a new in-memory logger

func (*MemoryLogger) Clear

func (m *MemoryLogger) Clear()

Clear removes all log entries

func (*MemoryLogger) Count

func (m *MemoryLogger) Count() int

Count returns the total number of log entries

func (*MemoryLogger) Debug

func (m *MemoryLogger) Debug(executionID string, message string)

Debug logs a debug message

func (*MemoryLogger) Entries

func (m *MemoryLogger) Entries(executionID string) []LogEntry

Entries returns all log entries for the specified executionID

func (*MemoryLogger) EntriesByLevel

func (m *MemoryLogger) EntriesByLevel(executionID string, level LogLevel) []LogEntry

EntriesByLevel returns all log entries with the specified executionID and level

func (*MemoryLogger) EntriesPaginated

func (m *MemoryLogger) EntriesPaginated(executionID string, limit, offset int) ([]LogEntry, int64)

EntriesPaginated returns paginated log entries for the specified executionID

func (*MemoryLogger) Error

func (m *MemoryLogger) Error(executionID string, message string)

Error logs an error message

func (*MemoryLogger) Info

func (m *MemoryLogger) Info(executionID string, message string)

Info logs an informational message

func (*MemoryLogger) Log

func (m *MemoryLogger) Log(executionID string, level LogLevel, message string)

Log records a log entry with the specified executionID, level and message

func (*MemoryLogger) String

func (m *MemoryLogger) String() string

String returns a formatted string representation of all log entries

func (*MemoryLogger) Warn

func (m *MemoryLogger) Warn(executionID string, message string)

Warn logs a warning message

type SQLiteLogger

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

SQLiteLogger is a SQLite-backed implementation of Logger

func NewSQLiteLogger

func NewSQLiteLogger(db *sql.DB) *SQLiteLogger

NewSQLiteLogger creates a new SQLite-backed logger

func (*SQLiteLogger) Debug

func (s *SQLiteLogger) Debug(executionID string, message string)

Debug logs a debug message

func (*SQLiteLogger) Entries

func (s *SQLiteLogger) Entries(executionID string) []LogEntry

Entries returns all log entries for the specified executionID

func (*SQLiteLogger) EntriesByExecutionID

func (s *SQLiteLogger) EntriesByExecutionID(executionID string) []LogEntry

EntriesByExecutionID returns all log entries for the specified executionID

func (*SQLiteLogger) EntriesByLevel

func (s *SQLiteLogger) EntriesByLevel(executionID string, level LogLevel) []LogEntry

EntriesByLevel returns all log entries with the specified executionID and level

func (*SQLiteLogger) EntriesPaginated

func (s *SQLiteLogger) EntriesPaginated(executionID string, limit, offset int) ([]LogEntry, int64)

EntriesPaginated returns paginated log entries for the specified executionID

func (*SQLiteLogger) Error

func (s *SQLiteLogger) Error(executionID string, message string)

Error logs an error message

func (*SQLiteLogger) Info

func (s *SQLiteLogger) Info(executionID string, message string)

Info logs an informational message

func (*SQLiteLogger) Log

func (s *SQLiteLogger) Log(executionID string, level LogLevel, message string)

Log records a log entry with the specified executionID, level and message

func (*SQLiteLogger) Warn

func (s *SQLiteLogger) Warn(executionID string, message string)

Warn logs a warning message

Jump to

Keyboard shortcuts

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