2023-12-28 12:35:05 -06:00
|
|
|
package log
|
|
|
|
|
|
|
|
import (
|
2023-12-30 20:48:24 -06:00
|
|
|
"errors"
|
2023-12-28 12:35:05 -06:00
|
|
|
origlog "log"
|
|
|
|
)
|
|
|
|
|
2023-12-30 22:42:29 -06:00
|
|
|
var SPEW bool = false
|
2023-12-30 20:48:24 -06:00
|
|
|
var INFO bool = true
|
|
|
|
var WARN bool = true
|
|
|
|
var ERROR bool = true
|
|
|
|
|
|
|
|
func All(b bool) {
|
|
|
|
Set("SPEW", b)
|
|
|
|
Set("INFO", b)
|
|
|
|
Set("WARN", b)
|
|
|
|
Set("ERROR", b)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Set(flag string, b bool) {
|
|
|
|
switch flag {
|
|
|
|
case "INFO":
|
|
|
|
INFO = b
|
|
|
|
case "WARN":
|
|
|
|
WARN = b
|
|
|
|
case "SPEW":
|
|
|
|
SPEW = b
|
|
|
|
case "ERROR":
|
|
|
|
ERROR = b
|
|
|
|
default:
|
|
|
|
Error(errors.New("unknown flag"), "Flag name sent:", flag)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Get(flag string) bool {
|
|
|
|
switch flag {
|
|
|
|
case "INFO":
|
|
|
|
return INFO
|
|
|
|
case "WARN":
|
|
|
|
return WARN
|
|
|
|
case "SPEW":
|
|
|
|
return SPEW
|
|
|
|
case "ERROR":
|
|
|
|
return ERROR
|
|
|
|
default:
|
|
|
|
Error(errors.New("unknown flag"), "Flag name sent:", flag)
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2023-12-28 12:35:05 -06:00
|
|
|
func Println(a ...any) {
|
|
|
|
origlog.Println(a...)
|
|
|
|
}
|
2023-12-29 17:24:39 -06:00
|
|
|
|
|
|
|
func Fatalf(s string, a ...any) {
|
|
|
|
origlog.Fatalf(s, a...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Fatal(s string, a ...any) {
|
|
|
|
origlog.Fatalf(s, a...)
|
|
|
|
}
|