Documentation
¶
Index ¶
- func HasErrored() bool
- func Levels() []string
- func ParseLevel(text string) (slog.Level, error)
- func SendEverythingToStderr()
- func SetLevel(level slog.Leveler)
- type CmdLogger
- func (c *CmdLogger) Enabled(_ context.Context, level slog.Level) bool
- func (c *CmdLogger) Handle(_ context.Context, record slog.Record) error
- func (c *CmdLogger) HasErrored() bool
- func (c *CmdLogger) SendEverythingToStderr()
- func (c *CmdLogger) WithAttrs(_ []slog.Attr) slog.Handler
- func (c *CmdLogger) WithGroup(_ string) slog.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasErrored ¶
func HasErrored() bool
HasErrored returns true if there have been any calls to Handle with a level of slog.LevelError, assuming the logger is a CmdLogger.
If the logger is not a CmdLogger, this will always return false.
func SendEverythingToStderr ¶
func SendEverythingToStderr()
SendEverythingToStderr tells the logger (if its in use) to send all logs to stderr regardless of their level.
This is useful if we're expecting to output structured data to stdout such as JSON, which cannot be mixed with other output.
Types ¶
type CmdLogger ¶
func (*CmdLogger) HasErrored ¶
HasErrored returns true if there have been any calls to Handle with a level of slog.LevelError
func (*CmdLogger) SendEverythingToStderr ¶
func (c *CmdLogger) SendEverythingToStderr()
SendEverythingToStderr tells the logger to send all logs to stderr regardless of their level.
This is useful if we're expecting to output structured data to stdout such as JSON, which cannot be mixed with other output.