Documentation
¶
Overview ¶
Package alerts provides a structured system for status notifications.
Package alerts provides a structured system for status notifications.
Package alerts provides structured output writers for different formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Alert ¶
Alert represents a system status notification.
func (*Alert) WithDetails ¶
WithDetails adds additional context details to the alert.
type FormatWriter ¶
type FormatWriter struct {
// contains filtered or unexported fields
}
FormatWriter writes alerts in different output formats.
func NewFormatWriter ¶
func NewFormatWriter(w io.Writer, format output.Format) *FormatWriter
NewFormatWriter creates a new FormatWriter for the specified format.
func (*FormatWriter) WithConfig ¶
func (fw *FormatWriter) WithConfig(config WriterConfig) *FormatWriter
WithConfig sets the writer configuration.
func (*FormatWriter) WriteAlert ¶
func (fw *FormatWriter) WriteAlert(alert *Alert) error
WriteAlert writes an alert in the configured format.
type Level ¶
type Level int
Level represents the severity of an alert.
const ( // LevelError indicates a failure or error condition. LevelError Level = iota // LevelWarning indicates a potential issue or important notice. LevelWarning // LevelInfo indicates general informational messages. LevelInfo // LevelSuccess indicates successful completion of an operation. LevelSuccess )
type Writer ¶
Writer handles alert output to different formats and destinations.
var DiscardWriter Writer = WriterFunc(func(*Alert) error { return nil })
DiscardWriter is a Writer that discards all alerts.
func MultiWriter ¶
MultiWriter creates a writer that writes to multiple writers.
func NewWriterTo ¶
NewWriterTo creates a Writer that writes to an io.Writer.
type WriterConfig ¶
WriterConfig configures alert output behavior.
type WriterFunc ¶
WriterFunc is an adapter to allow functions to be used as Writers.
func (WriterFunc) WriteAlert ¶
func (f WriterFunc) WriteAlert(alert *Alert) error
WriteAlert calls the function.