From a6a6d0d42d70aff21cf759b3c2d7645c7475c5f3 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 29 Mar 2022 15:33:10 +0200 Subject: Debugging: Implement a basic level-based file logger --- src/state.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/state.go') diff --git a/src/state.go b/src/state.go index 12ad57a..521390e 100644 --- a/src/state.go +++ b/src/state.go @@ -11,6 +11,9 @@ type VPNState struct { // The list of servers and organizations from disco DiscoList *DiscoList `json:"disco"` + + // The file we keep open for logging + LogFile *FileLogger `json:"-"` } func (state *VPNState) Register(name string, directory string, stateCallback func(string, string, string)) error { @@ -18,6 +21,11 @@ func (state *VPNState) Register(name string, directory string, stateCallback fun state.ConfigDirectory = directory state.StateCallback = stateCallback + // Initialize the logger + state.InitLog(LOG_WARNING) + + state.Log(LOG_INFO, "App Registered") + state.StateCallback("Start", "Registered", "app registered") // Try to load the previous configuration -- cgit v1.2.3