diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/api.go | 1 | ||||
| -rw-r--r-- | src/oauth.go | 2 | ||||
| -rw-r--r-- | src/state.go | 4 |
3 files changed, 5 insertions, 2 deletions
@@ -39,6 +39,7 @@ func (server *Server) apiAuthenticatedRetry(method string, endpoint string, opts var error *HTTPStatusError if errors.As(bodyErr, &error) { + GetVPNState().Log(LOG_INFO, fmt.Sprintf("API: Got HTTP error %v, retrying authenticated", bodyErr)) // Tell the method that the token is expired server.OAuth.Token.ExpiredTimestamp = GenerateTimeSeconds() return server.apiAuthenticated(method, endpoint, opts) diff --git a/src/oauth.go b/src/oauth.go index dd86279..45daf10 100644 --- a/src/oauth.go +++ b/src/oauth.go @@ -297,8 +297,10 @@ func (oauth *OAuth) Login() error { func (oauth *OAuth) EnsureTokens() error { if oauth.isTokensExpired() { + GetVPNState().Log(LOG_INFO, "OAuth: Tokens are expired, retrying with refresh tokens") err := oauth.getTokensWithRefresh() if err != nil { + GetVPNState().Log(LOG_INFO, fmt.Sprintf("OAuth: Refresh tokens with error %v, retrying with a new login phase", err)) // log that we're getting tokens using login return oauth.Login() } diff --git a/src/state.go b/src/state.go index 521390e..c146e61 100644 --- a/src/state.go +++ b/src/state.go @@ -24,14 +24,14 @@ func (state *VPNState) Register(name string, directory string, stateCallback fun // Initialize the logger state.InitLog(LOG_WARNING) - state.Log(LOG_INFO, "App Registered") + state.Log(LOG_INFO, "App registered") state.StateCallback("Start", "Registered", "app registered") // Try to load the previous configuration if state.LoadConfig() != nil { // This error can be safely ignored, as when the config does not load, the struct will not be filled - // Make sure to log this when we have implemented a good logging system + state.Log(LOG_INFO, "Previous configuration not found") } return nil } |
