Documentation ¶
Index ¶
- Constants
- Variables
- type ANSIMod
- type Handler
- type HandlerOptions
- type Theme
- type ThemeDef
- func (t ThemeDef) AttrKey() ANSIMod
- func (t ThemeDef) AttrValue() ANSIMod
- func (t ThemeDef) AttrValueError() ANSIMod
- func (t ThemeDef) Level(level slog.Level) ANSIMod
- func (t ThemeDef) LevelDebug() ANSIMod
- func (t ThemeDef) LevelError() ANSIMod
- func (t ThemeDef) LevelInfo() ANSIMod
- func (t ThemeDef) LevelWarn() ANSIMod
- func (t ThemeDef) Message() ANSIMod
- func (t ThemeDef) MessageDebug() ANSIMod
- func (t ThemeDef) Name() string
- func (t ThemeDef) Source() ANSIMod
- func (t ThemeDef) Timestamp() ANSIMod
Constants ¶
View Source
const ( Reset = iota Bold Faint Italic Underline CrossedOut = 9 )
View Source
const ( Black = iota + 30 Red Green Yellow Blue Magenta Cyan Gray )
View Source
const ( BrightBlack = iota + 90 BrightRed BrightGreen BrightYellow BrightBlue BrightMagenta BrightCyan White )
Variables ¶
View Source
var ResetMod = ToANSICode(Reset)
Functions ¶
This section is empty.
Types ¶
type Handler ¶ added in v0.1.0
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(out io.Writer, opts *HandlerOptions) *Handler
NewHandler creates a Handler that writes to w, using the given options. If opts is nil, the default options are used.
type HandlerOptions ¶
type HandlerOptions struct { // AddSource causes the handler to compute the source code position // of the log statement and add a SourceKey attribute to the output. AddSource bool // Level reports the minimum record level that will be logged. // The handler discards records with lower levels. // If Level is nil, the handler assumes LevelInfo. // The handler calls Level.Level for each record processed; // to adjust the minimum level dynamically, use a LevelVar. Level slog.Leveler // Disable colorized output NoColor bool // TimeFormat is the format used for time.DateTime TimeFormat string // Theme defines the colorized output using ANSI escape sequences Theme Theme }
HandlerOptions are options for a ConsoleHandler. A zero HandlerOptions consists entirely of default values.
type Theme ¶ added in v0.3.0
type Theme interface { Name() string Timestamp() ANSIMod Source() ANSIMod Message() ANSIMod MessageDebug() ANSIMod AttrKey() ANSIMod AttrValue() ANSIMod AttrValueError() ANSIMod LevelError() ANSIMod LevelWarn() ANSIMod LevelInfo() ANSIMod LevelDebug() ANSIMod Level(level slog.Level) ANSIMod }
func NewBrightTheme ¶ added in v0.3.0
func NewBrightTheme() Theme
func NewDefaultTheme ¶ added in v0.3.0
func NewDefaultTheme() Theme
type ThemeDef ¶ added in v0.3.0
type ThemeDef struct {
// contains filtered or unexported fields
}
func (ThemeDef) AttrValueError ¶ added in v0.3.0
func (ThemeDef) LevelDebug ¶ added in v0.3.0
func (ThemeDef) LevelError ¶ added in v0.3.0
func (ThemeDef) MessageDebug ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.