Skip to content

Commit

Permalink
Add info logging to Daemon
Browse files Browse the repository at this point in the history
Add info logging to Daemon for the following events: started, stopping,
interrupt signal, resume after sleep, XML profile update.

Signed-off-by: hwipl <33433250+hwipl@users.noreply.github.com>
  • Loading branch information
hwipl committed Jun 5, 2024
1 parent 3942521 commit 8aec00b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/daemon/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func run(args []string) error {
var err error
select {
case <-c:
log.Info("Daemon got interrupt signal")
case err = <-daemon.Errors():
}

Expand Down
5 changes: 4 additions & 1 deletion internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ func (d *Daemon) handleSleepMonEvent(sleep bool) {

// disconnect vpn on resume
if !sleep && d.status.OCRunning.Running() {
log.Info("Daemon resuming after sleep, disconnecting")
d.disconnectVPN()
}
}
Expand All @@ -476,7 +477,7 @@ func readXMLProfile(xmlProfile string) *xmlprofile.Profile {

// handleProfileUpdate handles a xml profile update.
func (d *Daemon) handleProfileUpdate() error {
log.Debug("Daemon handling XML profile update")
log.Info("Daemon got XML profile update")
d.profile = readXMLProfile(d.config.OpenConnect.XMLProfile)
d.stopTND()
d.stopTrafPol()
Expand Down Expand Up @@ -673,6 +674,7 @@ func (d *Daemon) start() {
defer d.server.Shutdown()

// run main loop
log.Info("Daemon started")
for {
select {
case req := <-d.server.Requests():
Expand Down Expand Up @@ -702,6 +704,7 @@ func (d *Daemon) start() {
}

case <-d.done:
log.Info("Daemon stopping")
return
}
}
Expand Down

0 comments on commit 8aec00b

Please sign in to comment.