Skip to content

Commit

Permalink
actually push debug package
Browse files Browse the repository at this point in the history
  • Loading branch information
LumePart committed Oct 23, 2024
1 parent 4e9b9c0 commit 12e7658
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions debug/debug.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package debug

import (
"log"
"runtime"
)

var debugMode bool

func Init(mode bool) {
debugMode = mode
}

func Debug(ctx string) {
if debugMode {
_, file, line, ok := runtime.Caller(1)
if ok {
log.Printf("DEBUG: %s:%d %s", file, line, ctx)
} else {
log.Printf("DEBUG: %s", ctx)
}
}
}

0 comments on commit 12e7658

Please sign in to comment.