summaryrefslogtreecommitdiff
path: root/src/state.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-29 15:33:10 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-29 15:33:10 +0200
commita6a6d0d42d70aff21cf759b3c2d7645c7475c5f3 (patch)
tree4d1b1982319c6922bb9d882a6684a689d601732d /src/state.go
parent3e7bae91097d9a67262ab0d0b8450d9371201629 (diff)
Debugging: Implement a basic level-based file logger
Diffstat (limited to 'src/state.go')
-rw-r--r--src/state.go8
1 files changed, 8 insertions, 0 deletions
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