38 lines
800 B
Go
38 lines
800 B
Go
package level
|
|
|
|
// Level defines all the available levels we can log at
|
|
type Level int32
|
|
|
|
const (
|
|
// DebugLevel is the lowest level of logging.
|
|
// Debug logs are intended for debugging and development purposes.
|
|
DebugLevel Level = iota + 1
|
|
|
|
// WarnLevel is used for undesired but relatively expected events,
|
|
// which may indicate a problem.
|
|
WarnLevel
|
|
|
|
// ErrorLevel is used for undesired and unexpected events that
|
|
// the program can recover from.
|
|
ErrorLevel
|
|
|
|
// FatalLevel is used for undesired and unexpected events that
|
|
// the program cannot recover from.
|
|
FatalLevel
|
|
)
|
|
|
|
func (l Level) String() string {
|
|
switch l {
|
|
case DebugLevel:
|
|
return "DEBUG"
|
|
case WarnLevel:
|
|
return "WARN"
|
|
case ErrorLevel:
|
|
return "ERROR"
|
|
case FatalLevel:
|
|
return "FATAL"
|
|
default:
|
|
return "UNKNOWN"
|
|
}
|
|
}
|