Documentation
¶
Index ¶
- Variables
- func ContextWith(ctx context.Context, l Logger) context.Context
- func NewConsoleRenderer(w io.Writer) *lipgloss.Renderer
- func SetDefaultLogger(f func() Logger)
- type Buffer
- type Collector
- type ConsoleFormatter
- type Core
- type Entry
- type EntryField
- type FieldMarshal
- type Formatter
- type FuncMarshal
- type JSONFormatter
- type Level
- type LevelEnablerFunc
- type Logger
- func (l Logger) Debug(args ...any)
- func (l Logger) Debugf(f string, args ...interface{})
- func (l Logger) Error(args ...any)
- func (l Logger) Errorf(f string, args ...interface{})
- func (l Logger) Fatal(args ...any)
- func (l Logger) Fatalf(f string, args ...interface{})
- func (l Logger) Fields(args ...interface{}) Logger
- func (l Logger) Info(args ...any)
- func (l Logger) Infof(f string, args ...interface{})
- func (l Logger) IsLevelEnabled(lvl Level) bool
- func (l Logger) Trace(args ...any)
- func (l Logger) Tracef(f string, args ...interface{})
- func (l Logger) Warn(args ...any)
- func (l Logger) Warnf(f string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var LevelColors = map[Level]lipgloss.TerminalColor{ TraceLevel: lipgloss.Color("#3FCD23"), DebugLevel: lipgloss.Color("#29C6E8"), InfoLevel: lipgloss.Color("#2C75FE"), WarnLevel: lipgloss.Color("#E7C229"), ErrorLevel: lipgloss.Color("#FF2A25"), PanicLevel: lipgloss.Color("#FF2A25"), FatalLevel: lipgloss.Color("#FF2A25"), }
Functions ¶
func SetDefaultLogger ¶
func SetDefaultLogger(f func() Logger)
Types ¶
type ConsoleFormatter ¶
type ConsoleFormatter struct {
// contains filtered or unexported fields
}
func NewConsoleFormatter ¶
func NewConsoleFormatter(r *lipgloss.Renderer) *ConsoleFormatter
func (*ConsoleFormatter) Format ¶
func (f *ConsoleFormatter) Format(entry Entry) Buffer
type Core ¶
func NewLevelEnabler ¶
func NewLevelEnabler(core Core, enabler LevelEnablerFunc) Core
type Entry ¶
type Entry struct { Timestamp time.Time Level Level Message string Fields []EntryField }
type EntryField ¶
type EntryField struct { Key string Value FieldMarshal }
type FieldMarshal ¶
func FallbackMarshal ¶
func FallbackMarshal(v any) FieldMarshal
func StringMarshal ¶
func StringMarshal(s string) FieldMarshal
type FuncMarshal ¶
func (FuncMarshal) Write ¶
func (f FuncMarshal) Write(w io.Writer)
type JSONFormatter ¶
func NewJSONFormatter ¶
func NewJSONFormatter() *JSONFormatter
func (*JSONFormatter) Format ¶
func (j *JSONFormatter) Format(entry Entry) Buffer
type LevelEnablerFunc ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func FromContext ¶
func (Logger) IsLevelEnabled ¶
Click to show internal directories.
Click to hide internal directories.