Documentation ¶
Index ¶
- Variables
- type Logger
- func (l Logger) Args(args ...any) []pterm.LoggerArgument
- func (l Logger) ArgsFromMap(m map[string]any) []pterm.LoggerArgument
- func (l Logger) Debug(msg string, args ...[]pterm.LoggerArgument)
- func (l Logger) Error(msg string, args ...[]pterm.LoggerArgument)
- func (l Logger) Fatal(msg string, args ...[]pterm.LoggerArgument)
- func (l Logger) Info(msg string, args ...[]pterm.LoggerArgument)
- func (l Logger) Trace(msg string, args ...[]pterm.LoggerArgument)
- func (l Logger) Warn(msg string, args ...[]pterm.LoggerArgument)
- func (l Logger) WithCaller(b ...bool) *Logger
- func (l Logger) WithCustomLogger(logger *pterm.Logger) *Logger
- func (l Logger) WithLevel(level pterm.LogLevel) *Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLogger = Logger{ Loggers: []*pterm.Logger{ pterm.DefaultLogger.WithLevel(pterm.LogLevelInfo), }, }
View Source
var DisabledLogger = Logger{}
Functions ¶
This section is empty.
Types ¶
type Logger ¶
Logger is a custom logger that wraps multiple pterm.Loggers. This enables printing to multiple locations such as the terminal and to file, using different formats.
func (Logger) Args ¶
func (l Logger) Args(args ...any) []pterm.LoggerArgument
Args converts any arguments to a slice of pterm.LoggerArgument.
func (Logger) ArgsFromMap ¶
func (l Logger) ArgsFromMap(m map[string]any) []pterm.LoggerArgument
ArgsFromMap converts a map to a slice of pterm.LoggerArgument.
func (Logger) Debug ¶
func (l Logger) Debug(msg string, args ...[]pterm.LoggerArgument)
Debug prints a debug log.
func (Logger) Error ¶
func (l Logger) Error(msg string, args ...[]pterm.LoggerArgument)
Error prints an error log.
func (Logger) Fatal ¶
func (l Logger) Fatal(msg string, args ...[]pterm.LoggerArgument)
Fatal prints a fatal log and exits the program.
func (Logger) Info ¶
func (l Logger) Info(msg string, args ...[]pterm.LoggerArgument)
Info prints an info log.
func (Logger) Trace ¶
func (l Logger) Trace(msg string, args ...[]pterm.LoggerArgument)
Trace prints a trace log.
func (Logger) Warn ¶
func (l Logger) Warn(msg string, args ...[]pterm.LoggerArgument)
Warn prints a warning log.
func (Logger) WithCaller ¶
WithCaller enables or disables the caller.
func (Logger) WithCustomLogger ¶
WithCustomLogger appends the logger to the list of loggers. A log call propagates to all the stored loggers.
Click to show internal directories.
Click to hide internal directories.