Partial success

This commit is contained in:
Fred Boniface 2023-07-19 01:18:55 +01:00
parent 99756041bc
commit efcce8a632
5 changed files with 9 additions and 6 deletions

View File

@ -4,12 +4,12 @@ import (
"fmt" "fmt"
"git.fjla.uk/owlboard/go-types/pkg/database" "git.fjla.uk/owlboard/go-types/pkg/database"
"git.fjla.uk/owlboard/mq-client/helpers" "git.fjla.uk/owlboard/mq-client/log"
) )
func init() { func init() {
fmt.Println("dbAccess/access.init() Will be used to push the component version number to the database") log.Msg.Info("Pushing mq-client version to database")
fmt.Printf("Version: %s\n", helpers.Version) fmt.Println("ACTUALLY DO THIS HERE!")
} }
func PutManyServices(collection string, data []database.Service) bool { func PutManyServices(collection string, data []database.Service) bool {

View File

@ -50,7 +50,7 @@ func initDataAccess() *mongo.Client {
fmt.Println(err) fmt.Println(err)
log.Msg.Fatal("Error connecting to database: " + err.Error()) log.Msg.Fatal("Error connecting to database: " + err.Error())
} else { } else {
log.Msg.Info("Connected to Database") log.Msg.Info("Database connection successful")
} }
return client return client
} }

View File

@ -23,6 +23,6 @@ func getRuntime() string {
if runtimeEnv == "" { if runtimeEnv == "" {
runtimeEnv = "unknown" runtimeEnv = "unknown"
} }
log.Msg.Info(fmt.Sprintf("Runtime mode: %s", runtimeEnv)) log.Msg.Debug(fmt.Sprintf("Runtime mode: %s", runtimeEnv))
return runtimeEnv return runtimeEnv
} }

View File

@ -20,6 +20,7 @@ func getCredentials() nrodCredential {
if nrod_user == "" || nrod_pass == "" { if nrod_user == "" || nrod_pass == "" {
log.Msg.Fatal("No NROD Credentials provided") log.Msg.Fatal("No NROD Credentials provided")
} }
log.Msg.Debug("NROD Credentials loaded for user: " + nrod_user)
return nrodCredential{ return nrodCredential{
user: nrod_user, user: nrod_user,
pass: nrod_pass, pass: nrod_pass,
@ -38,7 +39,8 @@ func dial() *stomp.Conn {
if err != nil { if err != nil {
log.Msg.Fatal("Unable to connect to STOMP Client", zap.String("err", err.Error())) 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 return conn
} }

View File

@ -22,5 +22,6 @@ func Listen() {
} }
func handle(msg *stomp.Message) { func handle(msg *stomp.Message) {
log.Msg.Info("STOMP message received")
fmt.Println(msg) fmt.Println(msg)
} }