Documentation
¶
Index ¶
- Constants
- func Debug(message string, a ...any)
- func Error(message string, a ...any)
- func Fatal(v ...any)
- func Fatalf(format string, v ...any)
- func Fatalln(v ...any)
- func Flags() int
- func Info(message string, a ...any)
- func Output(calldepth int, s string) error
- func Panic(v ...any)
- func Panicf(format string, v ...any)
- func Panicln(v ...any)
- func Prefix() string
- func Print(v ...any)
- func Printf(format string, v ...any)
- func Println(v ...any)
- func SetFlags(flag int)
- func SetLevel(level level)
- func SetLevelByString(level string)
- func SetLogger(logger *Logger)
- func SetOutput(w io.Writer)
- func SetPrefix(prefix string)
- func Trace(message string, a ...any)
- func Warn(message string, a ...any)
- func Writer() io.Writer
- type Format
- type LevelOutput
- type Logger
- func (l *Logger) Debug(message string, a ...any)
- func (l *Logger) EnableColors(c bool)
- func (l *Logger) Error(message string, a ...any)
- func (l *Logger) Fatal(v ...any)
- func (l *Logger) Fatalf(message string, a ...any)
- func (l *Logger) Fatalln(v ...any)
- func (l *Logger) Fprint(w io.Writer, a ...any) (n int, err error)
- func (l *Logger) Fprintf(w io.Writer, format string, a ...any) (n int, err error)
- func (l *Logger) GetColours() *aurora.Aurora
- func (l *Logger) Info(message string, a ...any)
- func (l *Logger) IsLogLevelEnabled(level level) bool
- func (l *Logger) LevelColor(level level, message any) aurora.Value
- func (l *Logger) LevelName(level level) string
- func (l *Logger) LevelOutput(level level) io.Writer
- func (l *Logger) Log(level level, message string, a ...any)
- func (l *Logger) Panic(v ...any)
- func (l *Logger) Panicf(message string, a ...any)
- func (l *Logger) Print(v ...any)
- func (l *Logger) PrintDebug(format any)
- func (l *Logger) PrintDebugf(format string, a ...any)
- func (l *Logger) Printf(format string, a ...any)
- func (l *Logger) SetDebug(d bool) *Logger
- func (l *Logger) SetLevel(level level) *Logger
- func (l *Logger) SetLevelByString(level string)
- func (l *Logger) Trace(message string, a ...any)
- func (l *Logger) Warn(message string, a ...any)
Constants ¶
View Source
const ( LevelFatal level = iota LevelError LevelWarn LevelInfo LevelDebug LevelTrace LevelAll )
All log levels
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶ added in v0.0.2
func Fatal(v ...any)
Fatal is equivalent to Print() followed by a call to os.Exit(1).
func Fatalln ¶ added in v0.0.6
func Fatalln(v ...any)
Fatalln is equivalent to Println() followed by a call to os.Exit(1).
func Flags ¶ added in v0.0.6
func Flags() int
Flags returns the output flags for the standard logger. and is unsupported in this package.
func SetLevelByString ¶ added in v0.0.6
func SetLevelByString(level string)
Types ¶
type LevelOutput ¶
type LevelOutput struct {
Fatal io.Writer
Error io.Writer
Warn io.Writer
Info io.Writer
Debug io.Writer
Trace io.Writer
Msg io.Writer
DebugMsg io.Writer
}
LevelOutput defines the output stream for screen
type Logger ¶
type Logger struct {
Level level
Output LevelOutput
Format Format
LogToScreen bool
LogFilePath string
LogFile io.Writer
ForceNewLine bool
// contains filtered or unexported fields
}
Logger Struture
func GetInstance ¶ added in v0.0.6
func GetInstance() *Logger
func (*Logger) EnableColors ¶ added in v0.0.6
EnableColors enables/disables colors
func (*Logger) GetColours ¶ added in v0.0.6
GetColours returns the aurora instance
func (*Logger) IsLogLevelEnabled ¶
IsLogLevelEnabled returns true if the given level is enabled
func (*Logger) LevelColor ¶
LevelColor returns the color of the given level
func (*Logger) LevelOutput ¶
LevelOutput returns the output stream for the given level
func (*Logger) PrintDebug ¶ added in v0.0.6
PrintDebug prints message with debug level
func (*Logger) PrintDebugf ¶ added in v0.0.6
PrintDebugf prints message with debug level and formatting
func (*Logger) SetLevelByString ¶ added in v0.0.6
Click to show internal directories.
Click to hide internal directories.