Documentation
¶
Index ¶
- Variables
- func Banner(text string) *banner.Builder
- func Box(content string) *style.BoxBuilder
- func Divider(text string) *style.DividerBuilder
- func Gradient(name string) color.Gradient
- func GradientMulti(colors ...string) color.Gradient
- func GradientRGB(start, end color.RGB) color.Gradient
- func Hex(hex string) color.RGB
- func KV(pairs map[string]any) *style.KVBuilder
- func Progress(label string, total int) *style.ProgressBar
- func RGB(r, g, b uint8) color.RGB
- func SetLevel(level Level)
- func SetOutput(w io.Writer)
- func Spin(message string) *style.Spinner
- func Table(headers []string, rows [][]string) *style.TableBuilder
- type Config
- type Entry
- func (e *Entry) Any(key string, value any) *Entry
- func (e *Entry) Bool(key string, value bool) *Entry
- func (e *Entry) Dur(key string, value time.Duration) *Entry
- func (e *Entry) Err(err error) *Entry
- func (e *Entry) Field(key string, value any) *Entry
- func (e *Entry) Float32(key string, value float32) *Entry
- func (e *Entry) Float64(key string, value float64) *Entry
- func (e *Entry) Int(key string, value int) *Entry
- func (e *Entry) Int64(key string, value int64) *Entry
- func (e *Entry) Msg(msg string)
- func (e *Entry) Msgf(format string, args ...any)
- func (e *Entry) Send()
- func (e *Entry) Str(key, value string) *Entry
- func (e *Entry) Time(key string, value time.Time) *Entry
- func (e *Entry) Uint(key string, value uint) *Entry
- func (e *Entry) Uint64(key string, value uint64) *Entry
- func (e *Entry) WithFields(fields F) *Entry
- type F
- type Field
- type Level
- type LevelConfig
- type Logger
- func (l *Logger) Ctx(ctx context.Context) *Logger
- func (l *Logger) Debug(msg string) *Entry
- func (l *Logger) EnableCaller(enabled bool)
- func (l *Logger) Error(msg string) *Entry
- func (l *Logger) Fatal(msg string) *Entry
- func (l *Logger) Info(msg string) *Entry
- func (l *Logger) Panic(msg string) *Entry
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) SetTimeFormat(tf string)
- func (l *Logger) Success(msg string) *Entry
- func (l *Logger) Trace(msg string) *Entry
- func (l *Logger) Warn(msg string) *Entry
- func (l *Logger) With(key string, value any) *Logger
- func (l *Logger) WithFields(fields F) *Entry
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLevelConfigs = map[Level]LevelConfig{ TraceLevel: { Name: "TRACE", Icon: "◦", Color: color.RGB{R: 128, G: 128, B: 128}, Bold: false, }, DebugLevel: { Name: "DEBUG", Icon: "●", Color: color.RGB{R: 169, G: 169, B: 169}, Bold: false, }, InfoLevel: { Name: "INFO", Icon: "●", Color: color.RGB{R: 96, G: 165, B: 250}, Bold: false, }, SuccessLevel: { Name: "SUCCESS", Icon: "✓", Color: color.RGB{R: 74, G: 222, B: 128}, Bold: true, }, WarnLevel: { Name: "WARN", Icon: "⚠", Color: color.RGB{R: 251, G: 191, B: 36}, Bold: true, }, ErrorLevel: { Name: "ERROR", Icon: "✖", Color: color.RGB{R: 248, G: 113, B: 113}, Bold: true, }, FatalLevel: { Name: "FATAL", Icon: "💀", Color: color.RGB{R: 239, G: 68, B: 68}, Bold: true, }, PanicLevel: { Name: "PANIC", Icon: "🔥", Color: color.RGB{R: 185, G: 28, B: 28}, Bold: true, }, }
Functions ¶
func Box ¶
func Box(content string) *style.BoxBuilder
func Divider ¶
func Divider(text string) *style.DividerBuilder
func GradientMulti ¶
Types ¶
type Entry ¶
type Entry struct {
Level Level
Message string
Timestamp time.Time
Fields []Field
Caller string
// contains filtered or unexported fields
}
func WithFields ¶
func (*Entry) WithFields ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) EnableCaller ¶
func (*Logger) SetTimeFormat ¶
func (*Logger) WithFields ¶
type Option ¶
type Option func(*Config)
func WithCaller ¶
func WithCallerDepth ¶
func WithOutput ¶
func WithTimeFormat ¶
Click to show internal directories.
Click to hide internal directories.