Make some traces into a log, remove others

This commit is contained in:
Eugene Bujak 2018-11-28 13:21:39 +03:00
parent 70c5afd6a5
commit aa3f3e2c43
3 changed files with 9 additions and 3 deletions

1
app.go
View File

@ -239,7 +239,6 @@ func askUsernamePasswordIfPossible() error {
_, err := os.Stat(configfile) _, err := os.Stat(configfile)
if !os.IsNotExist(err) { if !os.IsNotExist(err) {
// do nothing, file exists // do nothing, file exists
trace("File %s exists, won't ask for password", configfile)
return nil return nil
} }
if !terminal.IsTerminal(int(os.Stdin.Fd())) { if !terminal.IsTerminal(int(os.Stdin.Fd())) {

View File

@ -134,6 +134,13 @@ func parseParametersFromBody(r io.Reader) (map[string]string, error) {
// --------------------- // ---------------------
// debug logging helpers // 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{}) { func trace(format string, args ...interface{}) {
pc := make([]uintptr, 10) // at least 1 entry needed pc := make([]uintptr, 10) // at least 1 entry needed
runtime.Callers(2, pc) runtime.Callers(2, pc)

View File

@ -32,7 +32,7 @@ func upgradeConfig() error {
} }
schemaVersionInterface, ok := diskConfig["schema_version"] schemaVersionInterface, ok := diskConfig["schema_version"]
trace("schemaVersionInterface = %v, ok = %v", schemaVersionInterface, ok) log.Printf("%s(): got schema version %v", _Func(), schemaVersionInterface)
if !ok { if !ok {
// no schema version, set it to 0 // no schema version, set it to 0
schemaVersionInterface = 0 schemaVersionInterface = 0
@ -84,7 +84,7 @@ func upgradeConfigSchema(oldVersion int, diskConfig *map[string]interface{}) err
} }
func upgradeSchema0to1(diskConfig *map[string]interface{}) error { func upgradeSchema0to1(diskConfig *map[string]interface{}) error {
trace("Called") log.Printf("%s(): called", _Func())
// The first schema upgrade: // The first schema upgrade:
// No more "dnsfilter.txt", filters are now kept in data/filters/ // No more "dnsfilter.txt", filters are now kept in data/filters/