From efcce8a632de2302777f053c3cdea9f40c3011f2 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 19 Jul 2023 01:18:55 +0100 Subject: [PATCH] Partial success --- src/dbAccess/access.go | 6 +++--- src/dbAccess/client.go | 2 +- src/helpers/config.go | 2 +- src/messaging/client.go | 4 +++- src/messaging/vstp.go | 1 + 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/dbAccess/access.go b/src/dbAccess/access.go index 044b8b2..89106c5 100644 --- a/src/dbAccess/access.go +++ b/src/dbAccess/access.go @@ -4,12 +4,12 @@ import ( "fmt" "git.fjla.uk/owlboard/go-types/pkg/database" - "git.fjla.uk/owlboard/mq-client/helpers" + "git.fjla.uk/owlboard/mq-client/log" ) func init() { - fmt.Println("dbAccess/access.init() Will be used to push the component version number to the database") - fmt.Printf("Version: %s\n", helpers.Version) + log.Msg.Info("Pushing mq-client version to database") + fmt.Println("ACTUALLY DO THIS HERE!") } func PutManyServices(collection string, data []database.Service) bool { diff --git a/src/dbAccess/client.go b/src/dbAccess/client.go index a0ea125..7ae33d1 100644 --- a/src/dbAccess/client.go +++ b/src/dbAccess/client.go @@ -50,7 +50,7 @@ func initDataAccess() *mongo.Client { fmt.Println(err) log.Msg.Fatal("Error connecting to database: " + err.Error()) } else { - log.Msg.Info("Connected to Database") + log.Msg.Info("Database connection successful") } return client } diff --git a/src/helpers/config.go b/src/helpers/config.go index 3f2aab1..f9695c2 100644 --- a/src/helpers/config.go +++ b/src/helpers/config.go @@ -23,6 +23,6 @@ func getRuntime() string { if runtimeEnv == "" { runtimeEnv = "unknown" } - log.Msg.Info(fmt.Sprintf("Runtime mode: %s", runtimeEnv)) + log.Msg.Debug(fmt.Sprintf("Runtime mode: %s", runtimeEnv)) return runtimeEnv } diff --git a/src/messaging/client.go b/src/messaging/client.go index f042028..771bd7a 100644 --- a/src/messaging/client.go +++ b/src/messaging/client.go @@ -20,6 +20,7 @@ func getCredentials() nrodCredential { if nrod_user == "" || nrod_pass == "" { log.Msg.Fatal("No NROD Credentials provided") } + log.Msg.Debug("NROD Credentials loaded for user: " + nrod_user) return nrodCredential{ user: nrod_user, pass: nrod_pass, @@ -38,7 +39,8 @@ func dial() *stomp.Conn { if err != nil { log.Msg.Fatal("Unable to connect to STOMP Client", zap.String("err", err.Error())) } - defer disconnect(conn) + //defer disconnect(conn) // This exits as soon as the function has returned + log.Msg.Info("Initialised STOMP Client") return conn } diff --git a/src/messaging/vstp.go b/src/messaging/vstp.go index 9432d7a..09099d7 100644 --- a/src/messaging/vstp.go +++ b/src/messaging/vstp.go @@ -22,5 +22,6 @@ func Listen() { } func handle(msg *stomp.Message) { + log.Msg.Info("STOMP message received") fmt.Println(msg) }