Documentation ¶
Index ¶
- func ApplyFormatting(text string, formats ...ShellFormatting) string
- func FormatText(text string, formats ...ShellFormatting) string
- func JSON(level LogLevel, message string, fields map[string]string) []byte
- func ResetFormatting(text string) string
- func ShellColoredLevels(level LogLevel, message string, fields map[string]string) []byte
- func StreamReaderNewLines(logger func(message string, fields ...string), reader io.Reader)
- type LogFormatter
- type LogLevel
- type Logger
- func (l *Logger) Debug(msg string, fields ...string)
- func (l *Logger) Error(msg string, fields ...string)
- func (l *Logger) Fatal(msg string, fields ...string)
- func (l *Logger) Info(msg string, fields ...string)
- func (l *Logger) Panic(msg string, fields ...string)
- func (l *Logger) Trace(msg string, fields ...string)
- func (l *Logger) Warning(msg string, fields ...string)
- func (l *Logger) With(fields ...string) *Logger
- type ShellFormatting
- type TabulatedRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyFormatting ¶
func ApplyFormatting(text string, formats ...ShellFormatting) string
func FormatText ¶
func FormatText(text string, formats ...ShellFormatting) string
Format text using the provided directives. Append a reset directive, so following text will not be formatted. Use ApplyFormatting if this is not wanted.
func ResetFormatting ¶
func ShellColoredLevels ¶
Types ¶
type LogFormatter ¶
type Logger ¶
type Logger struct { Level LogLevel Formatter LogFormatter // contains filtered or unexported fields }
func DefaultLogger ¶
func DefaultLogger() *Logger
func NamedLogger ¶
type ShellFormatting ¶
type ShellFormatting int
const ( Reset ShellFormatting = iota Bold Faint Italic Underline BlinkSlow BlinkRapid ReverseVideo Concealed CrossedOut )
const ( FgBlack ShellFormatting = iota + 30 FgRed FgGreen FgYellow FgBlue FgMagenta FgCyan FgWhite )
Foreground text colors
const ( FgHiBlack ShellFormatting = iota + 90 FgHiRed FgHiGreen FgHiYellow FgHiBlue FgHiMagenta FgHiCyan FgHiWhite )
Foreground Hi-Intensity text colors
const ( BgBlack ShellFormatting = iota + 40 BgRed BgGreen BgYellow BgBlue BgMagenta BgCyan BgWhite )
Background text colors
const ( BgHiBlack ShellFormatting = iota + 100 BgHiRed BgHiGreen BgHiYellow BgHiBlue BgHiMagenta BgHiCyan BgHiWhite )
Background Hi-Intensity text colors
type TabulatedRow ¶
type TabulatedRow struct {
// contains filtered or unexported fields
}
func TabulateRow ¶
func TabulateRow() TabulatedRow
func (TabulatedRow) Delimiter ¶
func (t TabulatedRow) Delimiter(delimiter string) TabulatedRow
func (TabulatedRow) Field ¶
func (t TabulatedRow) Field(text string, width int, formatting ...ShellFormatting) TabulatedRow
func (TabulatedRow) String ¶
func (t TabulatedRow) String() string
Click to show internal directories.
Click to hide internal directories.