Skip to content

Commit

Permalink
Log changes of Daemon status
Browse files Browse the repository at this point in the history
Signed-off-by: hwipl <33433250+hwipl@users.noreply.github.com>
  • Loading branch information
hwipl committed Apr 19, 2024
1 parent 0e9eae6 commit 9403e6f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func (d *Daemon) setStatusTrustedNetwork(trusted bool) {
}

// status changed
log.WithField("TrustedNetwork", trustedNetwork).Info("Daemon changed TrustedNetwork status")
d.status.TrustedNetwork = trustedNetwork
d.dbus.SetProperty(dbusapi.PropertyTrustedNetwork, trustedNetwork)
}
Expand All @@ -93,6 +94,7 @@ func (d *Daemon) setStatusConnectionState(connectionState vpnstatus.ConnectionSt
}

// state changed
log.WithField("ConnectionState", connectionState).Info("Daemon changed ConnectionState status")
d.status.ConnectionState = connectionState
d.dbus.SetProperty(dbusapi.PropertyConnectionState, connectionState)
}
Expand All @@ -105,6 +107,7 @@ func (d *Daemon) setStatusIP(ip string) {
}

// ip changed
log.WithField("IP", ip).Info("Daemon changed IP status")
d.status.IP = ip
d.dbus.SetProperty(dbusapi.PropertyIP, ip)
}
Expand All @@ -117,6 +120,7 @@ func (d *Daemon) setStatusDevice(device string) {
}

// device changed
log.WithField("Device", device).Info("Daemon changed Device status")
d.status.Device = device
d.dbus.SetProperty(dbusapi.PropertyDevice, device)
}
Expand All @@ -129,6 +133,7 @@ func (d *Daemon) setStatusServer(server string) {
}

// connected server changed
log.WithField("Server", server).Info("Daemon changed Server status")
d.status.Server = server
d.dbus.SetProperty(dbusapi.PropertyServer, server)
}
Expand All @@ -141,6 +146,7 @@ func (d *Daemon) setStatusConnectedAt(connectedAt int64) {
}

// connection time changed
log.WithField("ConnectedAt", connectedAt).Info("Daemon changed ConnectedAt status")
d.status.ConnectedAt = connectedAt
d.dbus.SetProperty(dbusapi.PropertyConnectedAt, connectedAt)
}
Expand All @@ -153,6 +159,7 @@ func (d *Daemon) setStatusServers(servers []string) {
}

// servers changed
log.WithField("Servers", servers).Info("Daemon changed Servers status")
d.status.Servers = servers
d.dbus.SetProperty(dbusapi.PropertyServers, servers)
}
Expand All @@ -169,6 +176,7 @@ func (d *Daemon) setStatusOCRunning(running bool) {
}

// OC running state changed
log.WithField("OCRunning", ocrunning).Info("Daemon changed OCRunning status")
d.status.OCRunning = ocrunning
d.dbus.SetProperty(dbusapi.PropertyOCRunning, ocrunning)
}
Expand Down Expand Up @@ -196,7 +204,9 @@ func (d *Daemon) setStatusVPNConfig(config *vpnconfig.Config) {
d.dbus.SetProperty(dbusapi.PropertyVPNConfig, dbusapi.VPNConfigInvalid)
return
}
d.dbus.SetProperty(dbusapi.PropertyVPNConfig, string(b))
s := string(b)
log.WithField("VPNConfig", s).Info("Daemon changed VPNConfig status")
d.dbus.SetProperty(dbusapi.PropertyVPNConfig, s)
}

// connectVPN connects to the VPN using login info from client request.
Expand Down

0 comments on commit 9403e6f

Please sign in to comment.