Documentation
¶
Overview ¶
Package startuplog provides a ring buffer for recording startup events. It survives process cleanup so logs remain queryable after processes are removed from the registry.
Index ¶
- type StartupLogEntry
- type StartupLogFilter
- type StartupLogStore
- func (s *StartupLogStore) Add(entry *StartupLogEntry)
- func (s *StartupLogStore) Clear()
- func (s *StartupLogStore) Error(processID, scriptName, eventType, message string)
- func (s *StartupLogStore) Info(processID, scriptName, eventType, message string)
- func (s *StartupLogStore) Len() int
- func (s *StartupLogStore) Query(filter StartupLogFilter) []*StartupLogEntry
- func (s *StartupLogStore) Recent(d time.Duration, limit int) []*StartupLogEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StartupLogEntry ¶
type StartupLogEntry struct {
ProcessID string `json:"process_id"`
ScriptName string `json:"script_name"` // Name without project prefix
Level string `json:"level"` // "info", "warning", "error"
EventType string `json:"event_type"` // "started", "EADDRINUSE", "start_failed", "cleanup_failed", "port_cleanup", "dependency_wait", "skipped"
Message string `json:"message"`
Output string `json:"output,omitempty"` // Last lines of process output (errors only)
Port int `json:"port,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
StartupLogEntry records a startup event (success or failure) with diagnostic context.
type StartupLogFilter ¶
type StartupLogFilter struct {
Since time.Time
ProcessID string
Level string // "info", "warning", "error", or "" for all
Limit int
}
StartupLogFilter controls which entries are returned by Query.
type StartupLogStore ¶
type StartupLogStore struct {
// contains filtered or unexported fields
}
StartupLogStore is a ring buffer of recent startup events.
func NewStartupLogStore ¶
func NewStartupLogStore(maxSize int) *StartupLogStore
NewStartupLogStore creates a new store with the given capacity.
func (*StartupLogStore) Add ¶
func (s *StartupLogStore) Add(entry *StartupLogEntry)
Add inserts a startup log entry into the ring buffer.
func (*StartupLogStore) Error ¶
func (s *StartupLogStore) Error(processID, scriptName, eventType, message string)
Error adds an error log entry.
func (*StartupLogStore) Info ¶
func (s *StartupLogStore) Info(processID, scriptName, eventType, message string)
Info adds an informational log entry.
func (*StartupLogStore) Len ¶
func (s *StartupLogStore) Len() int
Len returns the current number of entries.
func (*StartupLogStore) Query ¶
func (s *StartupLogStore) Query(filter StartupLogFilter) []*StartupLogEntry
Query returns matching entries ordered oldest to newest.
func (*StartupLogStore) Recent ¶
func (s *StartupLogStore) Recent(d time.Duration, limit int) []*StartupLogEntry
Recent returns entries from the last duration, up to limit.