1
0
forked from baron/baron-sso

slog 통합

This commit is contained in:
2026-01-21 12:51:00 +09:00
parent 03c8c14aa1
commit c39857c66c
5 changed files with 127 additions and 121 deletions

View File

@@ -3,7 +3,7 @@ package service
import (
"context"
"fmt"
"log"
"log/slog"
"os"
"baron-sso-backend/internal/domain"
@@ -26,16 +26,15 @@ func NewEmailService() domain.EmailService {
sender := os.Getenv("AWS_SES_SENDER")
if region == "" || accessKey == "" || secretKey == "" {
log.Println("[EmailService] AWS configuration missing, email service will not work")
slog.Warn("[EmailService] AWS configuration missing, email service will not work")
return nil
}
cfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithRegion(region),
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, "")),
)
if err != nil {
log.Printf("[EmailService] Failed to load AWS config: %v", err)
slog.Error("Failed to load AWS config", "error", err)
return nil
}
@@ -71,9 +70,9 @@ func (s *SesServiceImpl) SendEmail(to, subject, body string) error {
_, err := s.client.SendEmail(context.TODO(), input)
if err != nil {
log.Printf("[EmailService] Failed to send email to %s: %v", to, err)
slog.Error("[EmailService] Failed to send email", "to", to, "error", err)
} else {
log.Printf("[EmailService] Email sent successfully to %s", to)
slog.Info("[EmailService] Email sent successfully", "to", to)
}
return err
}