Skip to content

Commit

Permalink
chore(): better log policy for over quota
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarlier committed Dec 6, 2023
1 parent 7c36392 commit 312a22e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/middleware/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Logger(next http.Handler) http.Handler {
requestID = ""
}
event := log.Debug()
if o.status >= 400 {
if o.status >= http.StatusBadRequest && o.status != http.StatusPaymentRequired {
event = log.Info()
}
event.Str(
Expand Down
4 changes: 3 additions & 1 deletion pkg/service/articles_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func (reg *Registry) CreateArticle(ctx context.Context, form model.ArticleCreate
}
if totalArticles >= plan.ArticlesLimit {
err = ErrUserQuotaReached
logger.Debug().Err(err).Uint(
logger.Info().Err(err).Str(
"plan", plan.Name,
).Uint(
"total", totalArticles,
).Msg(unableToCreateArticleErrorMsg)
return nil, err
Expand Down

0 comments on commit 312a22e

Please sign in to comment.