Fix bitmasking for logging

This commit is contained in:
Karl Hesselgren 2022-09-20 21:31:08 +02:00
parent 25ea53bfbb
commit 67b7cdfc1f
2 changed files with 7 additions and 7 deletions

View file

@ -1191,7 +1191,7 @@ func newRenderTexture2DFromPointer(ptr unsafe.Pointer) RenderTexture2D {
// Log message types
const (
LogAll = iota
LogAll = 1 << iota
LogTrace
LogDebug
LogInfo
@ -1201,4 +1201,4 @@ const (
LogNone
)
var logTypeFlags = LogInfo | LogWarning | LogError
var logTypeFlags byte = LogInfo | LogWarning | LogError

View file

@ -14,7 +14,7 @@ import (
)
// SetTraceLog - Enable trace log message types
func SetTraceLog(typeFlags int) {
func SetTraceLog(typeFlags byte) {
logTypeFlags = typeFlags
ctypeFlags := (C.int)(typeFlags)
@ -25,19 +25,19 @@ func SetTraceLog(typeFlags int) {
func TraceLog(msgType int, text string, v ...interface{}) {
switch msgType {
case LogInfo:
if logTypeFlags&LogInfo == 0 {
if logTypeFlags&LogInfo != 0 {
fmt.Printf("INFO: "+text+"\n", v...)
}
case LogWarning:
if logTypeFlags&LogWarning == 0 {
if logTypeFlags&LogWarning != 0 {
fmt.Printf("WARNING: "+text+"\n", v...)
}
case LogError:
if logTypeFlags&LogError == 0 {
if logTypeFlags&LogError != 0 {
fmt.Printf("ERROR: "+text+"\n", v...)
}
case LogDebug:
if logTypeFlags&LogDebug == 0 {
if logTypeFlags&LogDebug != 0 {
fmt.Printf("DEBUG: "+text+"\n", v...)
}
}