diff --git a/home/auth.go b/home/auth.go index c1c00594..c72ca546 100644 --- a/home/auth.go +++ b/home/auth.go @@ -71,6 +71,8 @@ type User struct { // InitAuth - create a global object func InitAuth(dbFilename string, users []User, sessionTTL uint32) *Auth { + log.Info("Initializing auth module: %s", dbFilename) + a := Auth{} a.sessionTTL = sessionTTL a.sessions = make(map[string]*session) @@ -83,7 +85,7 @@ func InitAuth(dbFilename string, users []User, sessionTTL uint32) *Auth { } a.loadSessions() a.users = users - log.Debug("Auth: initialized. users:%d sessions:%d", len(a.users), len(a.sessions)) + log.Info("Auth: initialized. users:%d sessions:%d", len(a.users), len(a.sessions)) return &a } diff --git a/home/home.go b/home/home.go index 63bb308e..98ad8841 100644 --- a/home/home.go +++ b/home/home.go @@ -43,10 +43,10 @@ const ( // Update-related variables var ( - versionString string - updateChannel string - versionCheckURL string - ARMVersion string + versionString = "dev" + updateChannel = "none" + versionCheckURL = "" + ARMVersion = "" ) const versionCheckPeriod = time.Hour * 8 @@ -155,11 +155,11 @@ func run(args options) { configureLogger(args) // print the first message after logger is configured - msg := "AdGuard Home, version %s, channel %s\n, arch %s %s" + msg := "AdGuard Home, version %s, channel %s, arch %s %s" if ARMVersion != "" { msg = msg + " v" + ARMVersion } - log.Printf(msg, versionString, updateChannel, runtime.GOOS, runtime.GOARCH, ARMVersion) + log.Printf(msg, versionString, updateChannel, runtime.GOOS, runtime.GOARCH) log.Debug("Current working directory is %s", Context.workDir) if args.runningAsService { log.Info("AdGuard Home is running as a service") @@ -169,6 +169,7 @@ func run(args options) { Context.firstRun = detectFirstRun() if Context.firstRun { + log.Info("This is the first time AdGuard Home is launched") requireAdminRights() } @@ -197,6 +198,7 @@ func run(args options) { err = parseConfig() if err != nil { + log.Error("Failed to parse configuration, exiting") os.Exit(1) } @@ -211,6 +213,7 @@ func run(args options) { config.DHCP.ConfigModified = onConfigModified Context.dhcpServer = dhcpd.Create(config.DHCP) if Context.dhcpServer == nil { + log.Error("Failed to initialize DHCP server, exiting") os.Exit(1) } Context.autoHosts.Init("") diff --git a/home/home_test.go b/home/home_test.go index 4e22e1ba..89901387 100644 --- a/home/home_test.go +++ b/home/home_test.go @@ -107,7 +107,7 @@ schema_version: 5 // . Wait until the filters are downloaded // . Stop and cleanup func TestHome(t *testing.T) { - // Reinit context + // Init new context Context = homeContext{} dir := prepareTestDir() @@ -135,11 +135,11 @@ func TestHome(t *testing.T) { time.Sleep(100 * time.Millisecond) } assert.Truef(t, err == nil, "%s", err) - assert.Equal(t, 200, resp.StatusCode) + assert.Equal(t, http.StatusOK, resp.StatusCode) resp, err = h.Get("http://127.0.0.1:3000/control/status") assert.Truef(t, err == nil, "%s", err) - assert.Equal(t, 200, resp.StatusCode) + assert.Equal(t, http.StatusOK, resp.StatusCode) // test DNS over UDP r := upstream.NewResolver("127.0.0.1:5354", 3*time.Second) diff --git a/home/web.go b/home/web.go index 04b2696e..c2145caa 100644 --- a/home/web.go +++ b/home/web.go @@ -42,6 +42,8 @@ type Web struct { // CreateWeb - create module func CreateWeb(conf *WebConfig) *Web { + log.Info("Initialize web module") + w := Web{} w.conf = conf