Documentation
¶
Index ¶
- type LogEntry
- type Logger
- func (log *Logger) Disabled() bool
- func (log *Logger) Group(name string) *Logger
- func (log *Logger) Hide(groups ...string) *Logger
- func (log *Logger) Indent() *Logger
- func (log *Logger) IndentWith(indent string) *Logger
- func (log *Logger) Log(args ...any) *Logger
- func (log *Logger) Logf(format string, args ...any) *Logger
- func (log *Logger) Show(groups ...string) *Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a tool for optionally logging messages.
func NewFunc ¶
NewFunc will create a logger that calls the given function to handle logging a message.
func NewWriter ¶
NewWriter creates a logger that writes logs to the given writer.
If the writer returns an error on any log, that error will be panicked from the call to create the log.
func Null ¶
func Null() *Logger
Null is a nil logger that is always disabled. This can be used to prevent logging.
func (*Logger) Group ¶
Group indicates that all the logs to the returned logger will be part of this group until another group is called. Only shown groups will be logged. If the group is an empty name, then it is shown.
func (*Logger) Hide ¶
Hide indicates which groups will not be logged. The receiver is not modified, the returned logger will have the still shown groups in it. This will update if the Logger is disabled or not.
func (*Logger) Indent ¶
Indent will add to the current indent for the message. The returned logger will be further indented. If the logger is disabled, this will have no effect.
func (*Logger) IndentWith ¶
IndentWith will add to the current indent for the message with the given text to add at the rightmost part of the indent. The returned logger will be further indented. If the logger is disabled, this will have no effect.