From aa3f3e2c434b3efd4f359f63384cf0ce867e45ee Mon Sep 17 00:00:00 2001 From: Eugene Bujak Date: Wed, 28 Nov 2018 13:21:39 +0300 Subject: [PATCH] Make some traces into a log, remove others --- app.go | 1 - helpers.go | 7 +++++++ upgrade.go | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app.go b/app.go index 96d73c2c..3544da90 100644 --- a/app.go +++ b/app.go @@ -239,7 +239,6 @@ func askUsernamePasswordIfPossible() error { _, err := os.Stat(configfile) if !os.IsNotExist(err) { // do nothing, file exists - trace("File %s exists, won't ask for password", configfile) return nil } if !terminal.IsTerminal(int(os.Stdin.Fd())) { diff --git a/helpers.go b/helpers.go index 03d1e2f4..66955033 100644 --- a/helpers.go +++ b/helpers.go @@ -134,6 +134,13 @@ func parseParametersFromBody(r io.Reader) (map[string]string, error) { // --------------------- // debug logging helpers // --------------------- +func _Func() string { + pc := make([]uintptr, 10) // at least 1 entry needed + runtime.Callers(2, pc) + f := runtime.FuncForPC(pc[0]) + return path.Base(f.Name()) +} + func trace(format string, args ...interface{}) { pc := make([]uintptr, 10) // at least 1 entry needed runtime.Callers(2, pc) diff --git a/upgrade.go b/upgrade.go index a9e26934..4154ee03 100644 --- a/upgrade.go +++ b/upgrade.go @@ -32,7 +32,7 @@ func upgradeConfig() error { } schemaVersionInterface, ok := diskConfig["schema_version"] - trace("schemaVersionInterface = %v, ok = %v", schemaVersionInterface, ok) + log.Printf("%s(): got schema version %v", _Func(), schemaVersionInterface) if !ok { // no schema version, set it to 0 schemaVersionInterface = 0 @@ -84,7 +84,7 @@ func upgradeConfigSchema(oldVersion int, diskConfig *map[string]interface{}) err } func upgradeSchema0to1(diskConfig *map[string]interface{}) error { - trace("Called") + log.Printf("%s(): called", _Func()) // The first schema upgrade: // No more "dnsfilter.txt", filters are now kept in data/filters/