diff options
| author | Shulhan <ms@kilabit.info> | 2025-01-26 15:44:04 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-01-26 15:44:04 +0700 |
| commit | 3826603fb49edda796c2a5541b39b5bb00d3745c (patch) | |
| tree | ee3f0109c9c1f2745010eb4f71c3e8db996799df | |
| parent | a87283b9236f24f62b0a8936ba0b7232c0407c45 (diff) | |
| download | rescached-3826603fb49edda796c2a5541b39b5bb00d3745c.tar.xz | |
all: replace debug package with internal Debug variabel
The [debug.Value] will be removed in the next release of pakakeh.go.
| -rw-r--r-- | cmd/rescached/main.go | 2 | ||||
| -rw-r--r-- | environment.go | 5 | ||||
| -rw-r--r-- | rescached.go | 8 |
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) |
