Skip to content

Commit

Permalink
Remove usage of slog
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwas Shashidhar committed Nov 16, 2023
1 parent f0b49be commit 44d3418
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cloud/aws_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package cloud
import (
"context"
"log"
"log/slog"

"github.com/aws/aws-sdk-go-v2/aws"
awsCfg "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials"

"github.com/adwitiyaio/arka/config"
"github.com/adwitiyaio/arka/dependency"
"github.com/adwitiyaio/arka/logger"
)

const regionKey = "AWS_REGION"
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions database/pgx_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"log"
"log/slog"
"strconv"
"strings"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 44d3418

Please sign in to comment.