diff --git a/infra/config/config.go b/infra/config/config.go index c571847..56eb86b 100644 --- a/infra/config/config.go +++ b/infra/config/config.go @@ -1,7 +1,7 @@ package config import ( - "log/slog" + "fmt" "path" "runtime" @@ -62,7 +62,7 @@ func NewConfig() (*Config, error) { err := viper.ReadInConfig() if err != nil { - slog.Error("Read config file.", "err", err) + fmt.Println("Read config file.", "err", err) return nil, err } @@ -70,7 +70,7 @@ func NewConfig() (*Config, error) { err = viper.Unmarshal(&conf) if err != nil { - slog.Error("Unmarshal config file.", "err", err) + fmt.Println("Unmarshal config file.", "err", err) return nil, err } diff --git a/infra/router/middleware/middleware.go b/infra/router/middleware/middleware.go index 58cacef..76a9145 100644 --- a/infra/router/middleware/middleware.go +++ b/infra/router/middleware/middleware.go @@ -1,7 +1,7 @@ package middleware import ( - "log/slog" + "fmt" "net/http" "github.com/gin-contrib/cors" @@ -21,7 +21,7 @@ func ErrorHandler(c *gin.Context) { c.Next() for _, err := range c.Errors { - slog.Error(err.Error()) + fmt.Println(err.Error()) } c.JSON(http.StatusInternalServerError, "") diff --git a/infra/router/util/validate.go b/infra/router/util/validate.go index c790c02..aa19c18 100644 --- a/infra/router/util/validate.go +++ b/infra/router/util/validate.go @@ -2,7 +2,6 @@ package util import ( "fmt" - "log/slog" "strconv" "github.com/gin-gonic/gin" @@ -12,7 +11,7 @@ func ValidateBody[T any](c *gin.Context) (*T, error) { var input T if err := c.ShouldBind(&input); err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, err } @@ -26,7 +25,7 @@ func ValidateQuery[T any](c *gin.Context) (*T, error) { fmt.Println(values) if err := c.ShouldBindQuery(&input); err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, err } @@ -38,7 +37,7 @@ func ValidateInt64Param(c *gin.Context, key string) (*int64, error) { id, err := strconv.ParseInt(param, 10, 64) if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, err } diff --git a/internal/usecase/item/item_ucase.go b/internal/usecase/item/item_ucase.go index e70ca7c..51ae436 100644 --- a/internal/usecase/item/item_ucase.go +++ b/internal/usecase/item/item_ucase.go @@ -1,7 +1,7 @@ package item import ( - "log/slog" + "fmt" "github.com/team-nerd-planet/api-server/internal/entity" ) @@ -19,7 +19,7 @@ func NewItemUsecase(itemRepo entity.ItemRepo) ItemUsecase { func (iu ItemUsecase) CountViewItem(company *string, companySizes *[]entity.CompanySizeType, jobTags, skillTags *[]int64) (*int64, bool) { count, err := iu.itemRepo.CountView(company, companySizes, jobTags, skillTags) if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, false } @@ -29,7 +29,7 @@ func (iu ItemUsecase) CountViewItem(company *string, companySizes *[]entity.Comp func (mu ItemUsecase) FindAllViewItem(company *string, companySizes *[]entity.CompanySizeType, jobTags, skillTags *[]int64, perPage int, page int) (*[]entity.ItemView, bool) { viewItems, err := mu.itemRepo.FindAllView(company, companySizes, jobTags, skillTags, perPage, page) if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, false } diff --git a/internal/usecase/subscription/subscriber_ucase.go b/internal/usecase/subscription/subscriber_ucase.go index e1c07db..54f2e59 100644 --- a/internal/usecase/subscription/subscriber_ucase.go +++ b/internal/usecase/subscription/subscriber_ucase.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "html/template" - "log/slog" "net/smtp" "path" "runtime" @@ -34,7 +33,7 @@ func NewSubscriptionUsecase( func (su SubscriptionUsecase) ApplySubscription(subscription entity.Subscription) (*entity.Subscription, bool) { id, err := su.subscriptionRepo.ExistEmail(subscription.Email) if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, false } @@ -50,7 +49,7 @@ func (su SubscriptionUsecase) ApplySubscription(subscription entity.Subscription tokenStr, err := generateEmailToken(token, su.conf.Jwt.SecretKey) if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, false } @@ -78,7 +77,7 @@ func (su SubscriptionUsecase) Subscribe(token string) (*entity.Subscription, boo emailToken, err = verifyEmailToken(token, su.conf.Jwt.SecretKey) if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, false } @@ -94,7 +93,7 @@ func (su SubscriptionUsecase) Subscribe(token string) (*entity.Subscription, boo } if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, false } @@ -120,13 +119,13 @@ func sendSubscribeMail(host string, port int, userName, password, email, token s configDirPath := path.Join(path.Dir(b)) t, err := template.ParseFiles(fmt.Sprintf("%s/template/subscription.html", configDirPath)) if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return err } var body bytes.Buffer if err := t.Execute(&body, data); err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return err } diff --git a/internal/usecase/tag/job_tag_ucase.go b/internal/usecase/tag/job_tag_ucase.go index 3d67588..0b83d8d 100644 --- a/internal/usecase/tag/job_tag_ucase.go +++ b/internal/usecase/tag/job_tag_ucase.go @@ -1,7 +1,7 @@ package tag import ( - "log/slog" + "fmt" "github.com/team-nerd-planet/api-server/internal/entity" ) @@ -19,7 +19,7 @@ func NewJobTagUsecase(jobTagRepo entity.JobTagRepo) JobTagUsecase { func (stu JobTagUsecase) FindAll() (*[]entity.JobTag, bool) { jobTags, err := stu.jobTagRepo.FindAll() if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, false } diff --git a/internal/usecase/tag/skill_tag_ucase.go b/internal/usecase/tag/skill_tag_ucase.go index 838e491..b8bdf9a 100644 --- a/internal/usecase/tag/skill_tag_ucase.go +++ b/internal/usecase/tag/skill_tag_ucase.go @@ -1,7 +1,7 @@ package tag import ( - "log/slog" + "fmt" "github.com/team-nerd-planet/api-server/internal/entity" ) @@ -19,7 +19,7 @@ func NewSkillTagUsecase(skillTagRepo entity.SkillTagRepo) SkillTagUsecase { func (stu SkillTagUsecase) FindAll() (*[]entity.SkillTag, bool) { skillTags, err := stu.skillTagRepo.FindAll() if err != nil { - slog.Error(err.Error()) + fmt.Println(err.Error()) return nil, false }