Documentation
¶
Index ¶
- func Error(arguments ...any)
- func Errorf(format string, arguments ...any)
- func Errorln(arguments ...any)
- func Fatal(arguments ...any)
- func Fatalf(format string, arguments ...any)
- func Fatalln(arguments ...any)
- func Info(arguments ...any)
- func Infof(format string, arguments ...any)
- func Infoln(arguments ...any)
- func SetLoggerConfiguration(config LoggerConfiguration)
- func Success(arguments ...any)
- func Successf(format string, arguments ...any)
- func Successln(arguments ...any)
- func Warn(arguments ...any)
- func Warnf(format string, arguments ...any)
- func Warnln(arguments ...any)
- type LoggerConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶ added in v1.1.0
func Error(arguments ...any)
Error prints an error message and doesnt exit.
func Errorln ¶ added in v1.1.0
func Errorln(arguments ...any)
Errorln prints an error message followed by a newline and doesnt exit
func Fatal ¶
func Fatal(arguments ...any)
Fatal prints a fatal error message and exits with status code 1.
func Fatalln ¶
func Fatalln(arguments ...any)
Fatalln prints a fatal error message followed by a newline and exits with status code 1.
func Info ¶
func Info(arguments ...any)
Info prints an informational message using default formatting.
func Infoln ¶
func Infoln(arguments ...any)
Infoln prints an informational message followed by a newline.
func SetLoggerConfiguration ¶
func SetLoggerConfiguration(config LoggerConfiguration)
SetLoggerConfiguration Replaces the global logger configuration example:
eyes.SetLoggerConfiguration(eyes.LoggerConfiguration{
DisplayName: "DEBUG", // goes in [DISPLAYNAME] 15:05:04 FATAL: Error message
PrefixTemplate: "[{display_name}] {timestamp} {log_level} ", // note the space at the end
TimestampFormat: "15:04:05", // which is: time.Now().Format("TimestampFormat HERE")
InfoTextColor: color.New(color.FgCyan), // use any color from github.com/fatih/color
WarnTextColor: color.New(color.FgYellow), // usually you should use ansi-16 colors
SuccessTextColor: color.New(color.FgGreen),
FatalTextColor: color.New(color.FgRed, color.Bold),
})
Types ¶
type LoggerConfiguration ¶
type LoggerConfiguration struct {
// DisplayName is substituted into {display_name}
// Example: "DEBUG", "Blink", "Aperture"
DisplayName string
// PrefixTemplate defines the exact text printed
// before every log message.
//
// Supported placeholders:
// {display_name} -> DisplayName
// {timestamp} -> current time
// {log_level} -> INFO, WARN, SUCCESS, FATAL
PrefixTemplate string
// TimestampFormat controls how {timestamp} is rendered
// Uses time.Format layout strings
TimestampFormat string
// Colors used for each log level
InfoTextColor *color.Color
WarnTextColor *color.Color
SuccessTextColor *color.Color
FatalTextColor *color.Color
}
LoggerConfiguration Holds all user-configurable settings for the logger
Click to show internal directories.
Click to hide internal directories.