Documentation ΒΆ
Index ΒΆ
- Variables
- func Debug(v ...any)
- func Error(v ...any)
- func Fatal(v ...any)
- func Info(v ...any)
- func Panic(v ...any)
- func Println(v ...any)
- func Warning(v ...any)
- type Logger
- func (l *Logger) Close() error
- func (l *Logger) Debug(v ...any)
- func (l *Logger) DisableColor()
- func (l *Logger) EnableColor()
- func (l *Logger) Error(v ...any)
- func (l *Logger) Fatal(v ...any)
- func (l *Logger) Info(v ...any)
- func (l *Logger) Panic(v ...any)
- func (l *Logger) Println(v ...any)
- func (l *Logger) Sdebug(v ...any) string
- func (l *Logger) Sdebugf(format string, v ...any) string
- func (l *Logger) Serror(v ...any) string
- func (l *Logger) Serrorf(format string, v ...any) string
- func (l *Logger) SetErrOutput(w io.Writer)
- func (l *Logger) SetErrOutputFile(path string) error
- func (l *Logger) SetLevel(lvl int)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) SetOutputFile(path string) error
- func (l *Logger) Sinfo(v ...any) string
- func (l *Logger) Sinfof(format string, v ...any) string
- func (l *Logger) Sprint(v ...any) string
- func (l *Logger) Sprintf(format string, v ...any) string
- func (l *Logger) Swarning(v ...any) string
- func (l *Logger) Swarningf(format string, v ...any) string
- func (l *Logger) Warning(v ...any)
- func (l *Logger) Write(b []byte)
- func (l *Logger) WriteErr(b []byte)
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var ( NoLevel = -2 // log without level, level-less logs will always be printed regardless of logger level DebugLevel = -1 // log at >= debug level InfoLevel = 0 // log at >= info level WarningLevel = 1 // log at >= warning level ErrorLevel = 2 // log at >= error level Disabled = 3 // log at > error level (disable the logger) )
Functions ΒΆ
Types ΒΆ
type Logger ΒΆ
type Logger struct { Level int // the minimum log level the logger will output Output io.Writer // default output of the logger ErrOutput io.Writer // default output for warning and error level logs DefaultFormat string // formatstring for level-less logs DefaultPrefix string // message prefix for level-less logs DefaultSuffix string // message suffix for level-less logs DebugFormat string // formatstring for debug level logs DebugPrefix string // message prefix for debug level logs DebugSuffix string // message suffix for debug level logs InfoFormat string // formatstring for info level logs InfoPrefix string // message prefix for info level logs InfoSuffix string // message suffix for info level logs WarningFormat string // formatstring for warning level logs WarningPrefix string // message prefix for warning level logs WarningSuffix string // message suffix for warning level logs ErrorFormat string // formatstring for error level logs ErrorPrefix string // message prefix for error level logs ErrorSuffix string // message suffix for error level logs }
var DefaultLogger *Logger // logger using default configuration
func NewLogger ΒΆ
func NewLogger() *Logger
NewLogger returns a new default Logger and should be used in most cases
func (*Logger) DisableColor ΒΆ
func (l *Logger) DisableColor()
DisableColor removes the coloring from the default level prefixes/suffixes
func (*Logger) EnableColor ΒΆ
func (l *Logger) EnableColor()
EnableColor resets the coloring on the default level prefixes/suffixes
func (*Logger) SetErrOutput ΒΆ
SetErrOutput sets the loggers output for error and warning level logs to the given writer
func (*Logger) SetErrOutputFile ΒΆ
SetErrOutputFile sets the loggers output for error and warning level logs to a file, it should be closed with Close() the given path will be appended to
func (*Logger) SetOutputFile ΒΆ
SetOutputFile sets the default loggers output to a file, it should be closed with Close() the given path will be appended to
Click to show internal directories.
Click to hide internal directories.