29 lines
421 B
Go
29 lines
421 B
Go
package main
|
|
|
|
import (
|
|
golog "log"
|
|
"os"
|
|
)
|
|
|
|
type logLevelT int
|
|
const (
|
|
Fatal logLevelT = 1 << iota
|
|
Error
|
|
Warn
|
|
Info
|
|
Debug
|
|
DebugGfx
|
|
)
|
|
|
|
var loglevel = Fatal | Error | Warn | Info
|
|
|
|
func log(level logLevelT, msg ...interface{}) {
|
|
if level & loglevel != 0 {
|
|
golog.Print(msg...)
|
|
}
|
|
if level & Fatal != 0 {
|
|
os.Exit(-1)
|
|
}
|
|
}
|
|
|