Add TraceLog

This commit is contained in:
Milan Nikolic 2017-01-31 10:31:03 +01:00
parent 7cd40090ef
commit 7132237dcd
2 changed files with 112 additions and 0 deletions

38
raylib/utils.go Normal file
View file

@ -0,0 +1,38 @@
// +build !android
package raylib
import (
"fmt"
"os"
)
// Log message types
const (
LogInfo = iota
LogError
LogWarning
LogDebug
)
var traceDebugMsgs = false
func TraceLog(msgType int, text string, v ...interface{}) {
switch msgType {
case LogInfo:
fmt.Printf("INFO: "+text+"\n", v...)
case LogError:
fmt.Printf("ERROR: "+text+"\n", v...)
os.Exit(1)
case LogWarning:
fmt.Printf("WARNING: "+text+"\n", v...)
case LogDebug:
if traceDebugMsgs {
fmt.Printf("DEBUG: "+text+"\n", v...)
}
}
}
func SetDebug(enabled bool) {
traceDebugMsgs = enabled
}