*: added more logging
This commit is contained in:
parent
4bdf22eadc
commit
1a34b96d03
|
@ -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
|
||||
}
|
||||
|
||||
|
|
15
home/home.go
15
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("")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue