Documentation
¶
Index ¶
- func GetListOfLevels() (result []string)
- type Levels
- type Logger
- func (log *Logger) Alert(msg string)
- func (log *Logger) Alertf(formatString string, msg ...any)
- func (log *Logger) Critical(msg string)
- func (log *Logger) Criticalf(formatString string, msg ...any)
- func (log *Logger) Debug(msg string)
- func (log *Logger) Debugf(formatString string, msg ...any)
- func (log *Logger) Error(msg string)
- func (log *Logger) Errorf(formatString string, msg ...any)
- func (log *Logger) Fatal(msg string, exitCode int)
- func (log *Logger) Fatalf(exitCode int, formatString string, msg ...any)
- func (log *Logger) Info(msg string)
- func (log *Logger) Infof(formatString string, msg ...any)
- func (log *Logger) Notice(msg string)
- func (log *Logger) Noticef(formatString string, msg ...any)
- func (log *Logger) SetLevel(level Levels) error
- func (log *Logger) SetTarget(stdout, stderr, syslog bool) (err error)
- func (log *Logger) Setup(useStdout, useStderr, useSyslog bool, level Levels) error
- func (log *Logger) UseBuffer(w io.Writer)
- func (log *Logger) UseStderr()
- func (log *Logger) UseStdout()
- func (log *Logger) UseSyslog()
- func (log *Logger) Warn(msg string)
- func (log *Logger) Warnf(formatString string, msg ...any)
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetListOfLevels ¶ added in v1.0.1
func GetListOfLevels() (result []string)
GetListOfLevels - return a []string list of log levels
Types ¶
type Levels ¶
type Levels uint8
Levels - A numeric indicator of the logging level
The assigned values follows https://datatracker.ietf.org/doc/html/rfc5424
const ( // Critical - system (application) is unusable Critical Levels = 0 // Alert - action must be taken immediately Alert Levels = 1 // Error - error conditions exist Error Levels = 2 // Warning - warning conditions exist Warning Levels = 3 // Notice - normal but significant conditions Notice Levels = 4 // Info - informational messages Info Levels = 5 // Informational - longer form of Info Informational Levels = Info // Debug - Debugging information Debug Levels = 6 )
func (*Levels) FromString ¶ added in v1.0.2
FromString - Given a string input, convert and store the matching log level or return an error
func (*Levels) ToSysLogPriority ¶
ToSysLogPriority - Convert our log levels to the syslog priorities.
The internal levels follow the syslog RFC pretty closely. But these levels may add non-RFC values in the future. This method converts our log levels to an RFC5424 user level priority value. See https://datatracker.ietf.org/doc/html/rfc5424
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger - A simple Logger facility
func (*Logger) SetTarget ¶
SetTarget - Set the current target of a logger object.
This method will set the first (left-most) true target type. Thus, if all three are true, stdout will take precedence. But also if none are true, stdout will be the default.
Source Files
¶
- GetListOfLevels.go
- Levels.FromString.go
- Levels.ToString.go
- Levels.ToSysLogPriority.go
- Levels.go
- Logger.Alert.go
- Logger.Critical.go
- Logger.Debug.go
- Logger.Error.go
- Logger.Fatal.go
- Logger.Info.go
- Logger.Notice.go
- Logger.SetLevel.go
- Logger.SetTarget.go
- Logger.Setup.go
- Logger.UseBuffer.go
- Logger.UseStderr.go
- Logger.UseStdout.go
- Logger.UseSyslog.go
- Logger.Warn.go
- Logger.Write.go
- Logger.go
- Target.go
- defaultLogFormat.go