From 44d3418c24d72273bda23d1f300859cb203d8c50 Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Thu, 16 Nov 2023 10:04:51 +0530 Subject: [PATCH] Remove usage of slog --- cloud/aws_manager.go | 6 +++--- database/pgx_manager.go | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cloud/aws_manager.go b/cloud/aws_manager.go index e15dab4..0d345c6 100644 --- a/cloud/aws_manager.go +++ b/cloud/aws_manager.go @@ -3,7 +3,6 @@ package cloud import ( "context" "log" - "log/slog" "github.com/aws/aws-sdk-go-v2/aws" awsCfg "github.com/aws/aws-sdk-go-v2/config" @@ -11,6 +10,7 @@ import ( "github.com/adwitiyaio/arka/config" "github.com/adwitiyaio/arka/dependency" + "github.com/adwitiyaio/arka/logger" ) const regionKey = "AWS_REGION" @@ -39,11 +39,11 @@ func (am *awsManager) initialize() { var err error // Try to load credentials from the specified aws profile awsProfile := cm.GetValueForKey("AWS_PROFILE") - slog.Info("Loading AWS credentials from profile") + logger.Log.Info().Msg("Loading AWS credentials from profile") am.config, err = awsCfg.LoadDefaultConfig(context.TODO(), awsCfg.WithSharedConfigProfile(awsProfile)) if err != nil { // Fallback to loading credentials from environment variables - slog.Info("Loading AWS credentials from environment variables") + logger.Log.Info().Msg("Loading AWS credentials from environment variables") am.region = cm.GetValueForKey(regionKey) accessKeyId := cm.GetValueForKey(accessKeyIdKey) secretAccessKey := cm.GetValueForKey(secretAccessKey) diff --git a/database/pgx_manager.go b/database/pgx_manager.go index 4ff9f12..d2b5583 100644 --- a/database/pgx_manager.go +++ b/database/pgx_manager.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "log" - "log/slog" "strconv" "strings" @@ -35,7 +34,7 @@ func (pdm *pgxDatabaseManager) GetInstance() *pgxpool.Pool { func (pdm pgxDatabaseManager) GetStatus() string { err := pdm.db.Ping(context.Background()) if err != nil { - slog.Error("failed to ping database, connection may be down") + logger.Log.Error().Err(err).Msg("failed to ping database, connection may be down") return constants.SystemStatusDown } return constants.SystemStatusUp