xonecas.io
5119
Lh

lazy-history / commit 5a5fc41

chore: use a single variable for IsDebug

Sean2025-05-02 5a5fc4112c489a54276f72068ca27d2e9d23182a parent 5da541c

2 files changed

lazy-history.go+0−1
@@ -55,5 +55,4 @@ func main() {
5555 for _, result := range results {
5656 lib.Debugf("found: %s", result)
5757 }
58-
5958 }
lib/log-util.go+4−2
@@ -5,14 +5,16 @@ import (
55 "os"
66 )
77
8+var IsDebug = os.Getenv("DEBUG") != ""
9+
810 func Debug(v ...interface{}) {
9- if os.Getenv("DEBUG") != "" {
11+ if IsDebug {
1012 log.Println(v...)
1113 }
1214 }
1315
1416 func Debugf(format string, v ...interface{}) {
15- if os.Getenv("DEBUG") != "" {
17+ if IsDebug {
1618 log.Printf(format, v...)
1719 }
1820 }