mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
refactor: redesign logging system for CLI-friendly output (#561)
* refactor: redesign logging system for CLI-friendly output * refactor: remove ANSI color support from logger * fix: address PR review feedback
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package log
|
||||
|
||||
// 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
|
||||
|
||||
// InfoLevel is used for user-facing progress and status messages.
|
||||
InfoLevel
|
||||
|
||||
// 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 "DBG"
|
||||
case InfoLevel:
|
||||
return "INF"
|
||||
case WarnLevel:
|
||||
return "WRN"
|
||||
case ErrorLevel:
|
||||
return "ERR"
|
||||
case FatalLevel:
|
||||
return "FTL"
|
||||
default:
|
||||
return "???"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user