From 0c9a300a58d9dacce7b84ff93222eed35eab5721 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 20 Jul 2022 16:07:13 +0200 Subject: Refactor: Do not log in internal packages The reason behind this is that we then do not have to pass a lot to each function. Logging inside internal packages is less useful as we want to let them return errors and only log in the 'public' facing API or let the client decide --- internal/discovery/discovery.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'internal/discovery') diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go index b4163a8..24ed01c 100644 --- a/internal/discovery/discovery.go +++ b/internal/discovery/discovery.go @@ -4,19 +4,15 @@ import ( "encoding/json" "fmt" - "github.com/jwijenbergh/eduvpn-common/internal/fsm" "github.com/jwijenbergh/eduvpn-common/internal/http" - "github.com/jwijenbergh/eduvpn-common/internal/log" - "github.com/jwijenbergh/eduvpn-common/internal/types" "github.com/jwijenbergh/eduvpn-common/internal/util" + "github.com/jwijenbergh/eduvpn-common/internal/types" "github.com/jwijenbergh/eduvpn-common/internal/verify" ) type Discovery struct { Organizations types.DiscoveryOrganizations Servers types.DiscoveryServers - FSM *fsm.FSM - Logger *log.FileLogger } // Helper function that gets a disco json @@ -59,11 +55,6 @@ func getDiscoFile(jsonFile string, previousVersion uint64, structure interface{} return string(fileBody), nil } -func (discovery *Discovery) Init(fsm *fsm.FSM, logger *log.FileLogger) { - discovery.FSM = fsm - discovery.Logger = logger -} - // FIXME: Implement based on // https://github.com/eduvpn/documentation/blob/v3/SERVER_DISCOVERY.md // - [IMPLEMENTED] on "first launch" when offering the search for "Institute Access" and "Organizations"; @@ -150,7 +141,6 @@ func (discovery *Discovery) DetermineServersUpdate() bool { if now >= should_update_time { return true } - discovery.Logger.Log(log.LOG_INFO, "No update needed for servers, 1h is not passed yet") return false } -- cgit v1.2.3