Documentation
¶
Index ¶
- Variables
- func DefaultPtermLogger(spinner *pterm.SpinnerPrinter) config.Logger
- func DisableColor()
- func DisableDebug()
- func DisableOutput()
- func EnableDebug()
- func EnableOutput()
- func Error(input any)
- func Header(header string)
- func Hyperlink(url, text string) string
- func Info(input any)
- func Infof(input any, args ...interface{})
- func IsTerminal() bool
- func Println(s string)
- func RenderTable(rows [][]string) string
- func Section(s string)
- func StatusIcon(ok bool) string
- func StatusIconTri(status string) string
- func StopSpinner(s Spinner)
- func Success(input any)
- func Warning(input any)
- func Warningf(input any, args ...any)
- type PtermLogger
- type Spinner
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PrimaryColor = lipgloss.Color("#CE0000") SuccessColor = lipgloss.Color("#10B981") WarningColor = lipgloss.Color("#F59E0B") ErrorColor = lipgloss.Color("#EF4444") MutedColor = lipgloss.Color("#6B7280") HeaderBgColor = lipgloss.Color("#1A1A1A") TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(PrimaryColor). Padding(0, 1) SectionStyle = lipgloss.NewStyle(). Bold(true). Foreground(PrimaryColor). MarginTop(1). MarginBottom(1) OkStyle = lipgloss.NewStyle(). Foreground(SuccessColor) WarnStyle = lipgloss.NewStyle(). Foreground(WarningColor) ErrStyle = lipgloss.NewStyle(). Foreground(ErrorColor) MutedStyle = lipgloss.NewStyle(). Foreground(MutedColor) TableHeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(HeaderBgColor). Padding(0, 1) TableCellStyle = lipgloss.NewStyle(). Padding(0, 1) BoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("#374151")). Padding(1, 2) )
Functions ¶
func DefaultPtermLogger ¶ added in v3.1.0
func DefaultPtermLogger(spinner *pterm.SpinnerPrinter) config.Logger
DefaultPtermLogger returns a Logger implementation that writes to the default pterm printers for each logging level.
If spinner is not nil, it is used to log status updates. The spinner must have been started already.
func DisableColor ¶
func DisableColor()
func DisableDebug ¶
func DisableDebug()
func DisableOutput ¶
func DisableOutput()
func EnableDebug ¶
func EnableDebug()
func EnableOutput ¶
func EnableOutput()
func IsTerminal ¶
func IsTerminal() bool
func RenderTable ¶
func StatusIcon ¶
func StatusIconTri ¶
func StopSpinner ¶
func StopSpinner(s Spinner)
Types ¶
type PtermLogger ¶ added in v3.1.0
type PtermLogger struct {
Error pterm.TextPrinter
Warning pterm.TextPrinter
Info pterm.TextPrinter
Debug pterm.TextPrinter
Spinner *pterm.SpinnerPrinter
}
PtermLogger is a Logger implementation that writes to pterm printers. If any field is nil, PtermLogger discards all messages of that level.
func (*PtermLogger) Debugf ¶ added in v3.1.0
func (logger *PtermLogger) Debugf(format string, a ...any)
func (*PtermLogger) Errorf ¶ added in v3.1.0
func (logger *PtermLogger) Errorf(format string, a ...any)
func (*PtermLogger) Infof ¶ added in v3.1.0
func (logger *PtermLogger) Infof(format string, a ...any)
func (*PtermLogger) Statusf ¶ added in v3.1.0
func (logger *PtermLogger) Statusf(format string, a ...any)
func (*PtermLogger) Warningf ¶ added in v3.1.0
func (logger *PtermLogger) Warningf(format string, a ...any)
Click to show internal directories.
Click to hide internal directories.