mirror of
https://github.com/la5nta/pat
synced 2026-08-13 17:46:54 -04:00
Also make the search case-insentitive since caseness is not strictly handled in HTML forms. Unsupported insertion tags are logged (debug).
27 lines
340 B
Go
27 lines
340 B
Go
package debug
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"strconv"
|
|
)
|
|
|
|
const (
|
|
EnvVar = "PAT_DEBUG"
|
|
Prefix = "[DEBUG] "
|
|
)
|
|
|
|
var enabled bool
|
|
|
|
func init() {
|
|
enabled, _ = strconv.ParseBool(os.Getenv(EnvVar))
|
|
}
|
|
|
|
func Enabled() bool { return enabled }
|
|
|
|
func Printf(format string, v ...interface{}) {
|
|
if !enabled {
|
|
return
|
|
}
|
|
log.Printf(Prefix+format, v...)
|
|
}
|