Files
kjol/go/l4g/debug.go

52 lines
840 B
Go

package l4g
import (
"fmt"
"log"
"os"
"time"
)
var debugLogger *log.Logger
func init() {
debugLogger = log.New(os.Stdout, "[DEBUG] ", log.LstdFlags)
}
func Debug(v ...any) {
debugLogger.Print(v...)
}
func Debugf(format string, v ...any) {
debugLogger.Printf(format, v...)
}
func Debugln(v ...any) {
debugLogger.Println(v...)
}
func DebugFatal(v ...any) {
debugLogger.Print(v...)
os.Exit(1)
}
func DebugFatalf(format string, v ...any) {
debugLogger.Printf(format, v...)
os.Exit(1)
}
func DebugFatalln(v ...any) {
debugLogger.Println(v...)
os.Exit(1)
}
func DebugInit(message string) {
timestamp := time.Now().Format("15:04:05")
fmt.Printf("[%s] INIT: %s\n", timestamp, message)
}
func DebugServer(message string) {
timestamp := time.Now().Format("15:04:05")
fmt.Printf("[%s] SERVER: %s\n", timestamp, message)
}