aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/rescached/main.go2
-rw-r--r--environment.go5
-rw-r--r--rescached.go8
3 files changed, 6 insertions, 9 deletions
diff --git a/cmd/rescached/main.go b/cmd/rescached/main.go
index 2ab18fe..8fa33b8 100644
--- a/cmd/rescached/main.go
+++ b/cmd/rescached/main.go
@@ -90,7 +90,7 @@ func main() {
log.Fatal(err)
}
- if debug.Value >= 4 {
+ if rescached.Debug >= 4 {
go debugRuntime()
}
diff --git a/environment.go b/environment.go
index 22a8ef1..7df8bcd 100644
--- a/environment.go
+++ b/environment.go
@@ -10,7 +10,6 @@ import (
"strconv"
"strings"
- "git.sr.ht/~shulhan/pakakeh.go/lib/debug"
"git.sr.ht/~shulhan/pakakeh.go/lib/dns"
libhttp "git.sr.ht/~shulhan/pakakeh.go/lib/http"
"git.sr.ht/~shulhan/pakakeh.go/lib/ini"
@@ -142,7 +141,7 @@ func (env *Environment) init() (err error) {
_, _ = env.loadResolvConf()
}
- debug.Value = env.Debug
+ Debug = env.Debug
if env.HttpdOptions.Memfs == nil {
env.HttpdOptions.Memfs = mfsWww
@@ -193,7 +192,7 @@ func (env *Environment) loadResolvConf() (ok bool, err error) {
return false, err
}
- if debug.Value > 0 {
+ if Debug > 0 {
fmt.Printf("loadResolvConf: %+v\n", rc)
}
diff --git a/rescached.go b/rescached.go
index 47701fb..feda6c6 100644
--- a/rescached.go
+++ b/rescached.go
@@ -12,7 +12,6 @@ import (
"sync"
"time"
- "git.sr.ht/~shulhan/pakakeh.go/lib/debug"
"git.sr.ht/~shulhan/pakakeh.go/lib/dns"
"git.sr.ht/~shulhan/pakakeh.go/lib/http"
"git.sr.ht/~shulhan/pakakeh.go/lib/watchfs/v2"
@@ -21,6 +20,9 @@ import (
// Version of program, overwritten by build.
var Version = `4.4.3`
+// Debug level, set by configuration as "rescached::debug".
+var Debug int
+
// Server implement caching DNS server.
type Server struct {
dns *dns.Server
@@ -33,10 +35,6 @@ type Server struct {
// New create and initialize new rescached server.
func New(env *Environment) (srv *Server, err error) {
- if debug.Value >= 1 {
- fmt.Printf("--- rescached: config: %+v\n", env)
- }
-
err = env.init()
if err != nil {
return nil, fmt.Errorf("rescached: New: %w", err)