Documentation
¶
Index ¶
- Constants
- func Fatalf(logger Logger, format string, v ...interface{})
- func GetTerminalSize() (width, height int)
- func IsTUISupported() bool
- type AnimationFrames
- type BufferSnapshot
- type ConsoleLogger
- func (l *ConsoleLogger) Codef(format string, v ...interface{})
- func (l *ConsoleLogger) Debugf(format string, v ...interface{})
- func (l *ConsoleLogger) Errorf(format string, v ...interface{})
- func (l *ConsoleLogger) Infof(format string, v ...interface{})
- func (l *ConsoleLogger) Mooncake()
- func (l *ConsoleLogger) SetLogLevel(logLevel int)
- func (l *ConsoleLogger) SetLogLevelStr(logLevel string) error
- func (l *ConsoleLogger) Textf(format string, v ...interface{})
- func (l *ConsoleLogger) WithPadLevel(padLevel int) Logger
- type LogEntry
- type Logger
- type ProgressInfo
- type StepEntry
- type TUIBuffer
- type TUIDisplay
- type TUILogger
- func (l *TUILogger) Codef(format string, v ...interface{})
- func (l *TUILogger) Debugf(format string, v ...interface{})
- func (l *TUILogger) Errorf(format string, v ...interface{})
- func (l *TUILogger) Infof(format string, v ...interface{})
- func (l *TUILogger) Mooncake()
- func (l *TUILogger) SetLogLevel(logLevel int)
- func (l *TUILogger) SetLogLevelStr(logLevel string) error
- func (l *TUILogger) Start()
- func (l *TUILogger) Stop()
- func (l *TUILogger) Textf(format string, v ...interface{})
- func (l *TUILogger) WithPadLevel(padLevel int) Logger
- type TerminalInfo
- type TestLogger
- func (t *TestLogger) Clear()
- func (t *TestLogger) Codef(format string, v ...interface{})
- func (t *TestLogger) Contains(substr string) bool
- func (t *TestLogger) ContainsLevel(level, substr string) bool
- func (t *TestLogger) Count() int
- func (t *TestLogger) CountLevel(level string) int
- func (t *TestLogger) Debugf(format string, v ...interface{})
- func (t *TestLogger) Errorf(format string, v ...interface{})
- func (t *TestLogger) GetLogs() []LogEntry
- func (t *TestLogger) Infof(format string, v ...interface{})
- func (t *TestLogger) Mooncake()
- func (t *TestLogger) SetLogLevel(logLevel int)
- func (t *TestLogger) SetLogLevelStr(logLevel string) error
- func (t *TestLogger) Textf(format string, v ...interface{})
- func (t *TestLogger) WithPadLevel(padLevel int) Logger
Constants ¶
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel = iota // InfoLevel is the default logging priority. InfoLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-logLevel logs. ErrorLevel )
Variables ¶
This section is empty.
Functions ¶
func GetTerminalSize ¶
func GetTerminalSize() (width, height int)
GetTerminalSize returns the current terminal size Returns default 80x24 if detection fails
func IsTUISupported ¶
func IsTUISupported() bool
IsTUISupported checks if the terminal supports TUI mode Returns true if terminal is detected, supports ANSI codes, and meets minimum size requirements
Types ¶
type AnimationFrames ¶
type AnimationFrames struct {
// contains filtered or unexported fields
}
AnimationFrames manages animation frames for the mooncake character
func LoadEmbeddedFrames ¶
func LoadEmbeddedFrames() (*AnimationFrames, error)
LoadEmbeddedFrames loads animation frames from the embedded content
func LoadFramesFromFile ¶
func LoadFramesFromFile(path string) (*AnimationFrames, error)
LoadFramesFromFile loads animation frames from a file Frames are expected to be 3 lines each, separated by blank lines
func LoadFramesFromString ¶
func LoadFramesFromString(content string) (*AnimationFrames, error)
LoadFramesFromString loads animation frames from a string Frames are expected to be 3 lines each, separated by blank lines
func (*AnimationFrames) Current ¶
func (a *AnimationFrames) Current() []string
Current returns the current frame without advancing
func (*AnimationFrames) FrameCount ¶
func (a *AnimationFrames) FrameCount() int
FrameCount returns the total number of frames
func (*AnimationFrames) Next ¶
func (a *AnimationFrames) Next() []string
Next advances to the next frame and returns it
type BufferSnapshot ¶
type BufferSnapshot struct {
StepHistory []StepEntry
CurrentStep string
Progress ProgressInfo
DebugMessages []string
ErrorMessages []string
}
BufferSnapshot is an atomic snapshot of the buffer state for rendering
type ConsoleLogger ¶
type ConsoleLogger struct {
// contains filtered or unexported fields
}
ConsoleLogger implements Logger interface with colored console output
func NewConsoleLogger ¶
func NewConsoleLogger(logLevel int) *ConsoleLogger
NewConsoleLogger creates a ConsoleLogger directly (for type-specific needs)
func (*ConsoleLogger) Codef ¶
func (l *ConsoleLogger) Codef(format string, v ...interface{})
func (*ConsoleLogger) Debugf ¶
func (l *ConsoleLogger) Debugf(format string, v ...interface{})
func (*ConsoleLogger) Errorf ¶
func (l *ConsoleLogger) Errorf(format string, v ...interface{})
func (*ConsoleLogger) Infof ¶
func (l *ConsoleLogger) Infof(format string, v ...interface{})
func (*ConsoleLogger) Mooncake ¶
func (l *ConsoleLogger) Mooncake()
func (*ConsoleLogger) SetLogLevel ¶
func (l *ConsoleLogger) SetLogLevel(logLevel int)
func (*ConsoleLogger) SetLogLevelStr ¶
func (l *ConsoleLogger) SetLogLevelStr(logLevel string) error
func (*ConsoleLogger) Textf ¶
func (l *ConsoleLogger) Textf(format string, v ...interface{})
func (*ConsoleLogger) WithPadLevel ¶
func (l *ConsoleLogger) WithPadLevel(padLevel int) Logger
type Logger ¶
type Logger interface {
Infof(format string, v ...interface{})
Debugf(format string, v ...interface{})
Errorf(format string, v ...interface{})
Codef(format string, v ...interface{})
Textf(format string, v ...interface{})
Mooncake()
SetLogLevel(logLevel int)
SetLogLevelStr(logLevel string) error
WithPadLevel(padLevel int) Logger
}
Logger interface defines the logging contract
type ProgressInfo ¶
ProgressInfo tracks overall execution progress
type StepEntry ¶
type StepEntry struct {
Name string
Status string // "success", "error", "skipped", "running"
Level int // Nesting level for indentation
Timestamp time.Time
}
StepEntry represents a single step in the execution history
type TUIBuffer ¶
type TUIBuffer struct {
// contains filtered or unexported fields
}
TUIBuffer manages step history and message buffering
func NewTUIBuffer ¶
NewTUIBuffer creates a new TUI buffer with specified history size
func (*TUIBuffer) GetSnapshot ¶
func (b *TUIBuffer) GetSnapshot() BufferSnapshot
GetSnapshot returns an atomic snapshot of the buffer state
func (*TUIBuffer) SetCurrentStep ¶
func (b *TUIBuffer) SetCurrentStep(name string, progress ProgressInfo)
SetCurrentStep sets the currently executing step
type TUIDisplay ¶
type TUIDisplay struct {
// contains filtered or unexported fields
}
TUIDisplay handles screen rendering for the animated TUI
func NewTUIDisplay ¶
func NewTUIDisplay(animator *AnimationFrames, buffer *TUIBuffer, width, height int) *TUIDisplay
NewTUIDisplay creates a new TUI display renderer
func (*TUIDisplay) Render ¶
func (d *TUIDisplay) Render() string
Render generates the complete screen output
type TUILogger ¶
type TUILogger struct {
// contains filtered or unexported fields
}
TUILogger implements Logger interface with animated TUI display
func NewTUILogger ¶
NewTUILogger creates a new TUI logger
func (*TUILogger) Mooncake ¶
func (l *TUILogger) Mooncake()
Mooncake displays the mooncake banner (initializes display)
func (*TUILogger) SetLogLevel ¶
SetLogLevel sets the log level
func (*TUILogger) SetLogLevelStr ¶
SetLogLevelStr sets the log level from a string
func (*TUILogger) WithPadLevel ¶
WithPadLevel creates a new logger with the specified padding level
type TerminalInfo ¶
TerminalInfo contains information about terminal capabilities
func DetectTerminal ¶
func DetectTerminal() TerminalInfo
DetectTerminal detects terminal capabilities and returns terminal information
type TestLogger ¶
type TestLogger struct {
Logs []LogEntry
// contains filtered or unexported fields
}
TestLogger implements Logger interface and captures log output for testing
func NewTestLogger ¶
func NewTestLogger() *TestLogger
NewTestLogger creates a new TestLogger for use in tests
func (*TestLogger) Codef ¶
func (t *TestLogger) Codef(format string, v ...interface{})
func (*TestLogger) Contains ¶
func (t *TestLogger) Contains(substr string) bool
Contains checks if any log message contains the substring
func (*TestLogger) ContainsLevel ¶
func (t *TestLogger) ContainsLevel(level, substr string) bool
ContainsLevel checks if any log at the specified level contains the substring
func (*TestLogger) CountLevel ¶
func (t *TestLogger) CountLevel(level string) int
CountLevel returns the number of log entries at the specified level
func (*TestLogger) Debugf ¶
func (t *TestLogger) Debugf(format string, v ...interface{})
func (*TestLogger) Errorf ¶
func (t *TestLogger) Errorf(format string, v ...interface{})
func (*TestLogger) GetLogs ¶
func (t *TestLogger) GetLogs() []LogEntry
GetLogs returns a copy of all log entries
func (*TestLogger) Infof ¶
func (t *TestLogger) Infof(format string, v ...interface{})
func (*TestLogger) Mooncake ¶
func (t *TestLogger) Mooncake()
func (*TestLogger) SetLogLevel ¶
func (t *TestLogger) SetLogLevel(logLevel int)
func (*TestLogger) SetLogLevelStr ¶
func (t *TestLogger) SetLogLevelStr(logLevel string) error
func (*TestLogger) Textf ¶
func (t *TestLogger) Textf(format string, v ...interface{})
func (*TestLogger) WithPadLevel ¶
func (t *TestLogger) WithPadLevel(padLevel int) Logger