2021-10-30 10:19:16 +02:00
|
|
|
package logging
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* IMPORTS
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
2021-11-04 11:06:16 +01:00
|
|
|
* MAIN METHODS logging
|
2021-10-30 10:19:16 +02:00
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
2021-11-04 11:06:16 +01:00
|
|
|
func Plain(line interface{}, args ...interface{}) {
|
|
|
|
logGeneric(os.Stdout, "", line, args...)
|
2021-10-30 10:19:16 +02:00
|
|
|
}
|
|
|
|
|
2021-11-04 11:06:16 +01:00
|
|
|
func Info(line interface{}, args ...interface{}) {
|
|
|
|
logGeneric(os.Stdout, "[\033[94;1mINFO\033[0m]", line, args...)
|
2021-10-30 10:19:16 +02:00
|
|
|
}
|
|
|
|
|
2021-11-04 11:06:16 +01:00
|
|
|
func Debug(line interface{}, args ...interface{}) {
|
2021-10-30 10:19:16 +02:00
|
|
|
if !debugmode {
|
|
|
|
return
|
|
|
|
}
|
2021-11-04 11:06:16 +01:00
|
|
|
logGeneric(os.Stdout, "[\033[96;1mDEBUG\033[0m]", line, args...)
|
2021-10-30 10:19:16 +02:00
|
|
|
}
|
|
|
|
|
2021-11-04 11:06:16 +01:00
|
|
|
func Warn(line interface{}, args ...interface{}) {
|
|
|
|
logGeneric(os.Stdout, "[\033[93;1mWARNING\033[0m]", line, args...)
|
2021-10-30 10:19:16 +02:00
|
|
|
}
|
|
|
|
|
2021-11-04 11:06:16 +01:00
|
|
|
func Error(line interface{}, args ...interface{}) {
|
|
|
|
logGeneric(os.Stderr, "[\033[91;1mERROR\033[0m]", line, args...)
|
2021-10-30 10:19:16 +02:00
|
|
|
}
|
|
|
|
|
2021-11-04 11:06:16 +01:00
|
|
|
func Fatal(line interface{}, args ...interface{}) {
|
|
|
|
logGeneric(os.Stderr, "[\033[91;1mFATAL\033[0m]", line, args...)
|
2021-10-30 10:19:16 +02:00
|
|
|
os.Exit(1)
|
|
|
|
}
|