Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
return Warn level
Browse files Browse the repository at this point in the history
Signed-off-by: Musilah <[email protected]>
  • Loading branch information
Musilah committed Jan 22, 2024
1 parent 100a208 commit 3007c66
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions users/api/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (lm *loggingMiddleware) RegisterClient(ctx context.Context, token string, c
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Register client failed to complete successfully", args...)
lm.logger.Warn("Register client failed to complete successfully", args...)
return
}
lm.logger.Info("Register client completed successfully", args...)
Expand All @@ -57,7 +57,7 @@ func (lm *loggingMiddleware) IssueToken(ctx context.Context, identity, secret, d
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Issue token failed to complete successfully", args...)
lm.logger.Warn("Issue token failed to complete successfully", args...)
return
}
lm.logger.Info("Issue token completed successfully", args...)
Expand All @@ -78,7 +78,7 @@ func (lm *loggingMiddleware) RefreshToken(ctx context.Context, refreshToken, dom
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Refresh token failed to complete successfully", args...)
lm.logger.Warn("Refresh token failed to complete successfully", args...)
return
}
lm.logger.Info("Refresh token completed successfully", args...)
Expand All @@ -96,7 +96,7 @@ func (lm *loggingMiddleware) ViewClient(ctx context.Context, token, id string) (
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("View client failed to complete successfully", args...)
lm.logger.Warn("View client failed to complete successfully", args...)
return
}
lm.logger.Info("View client completed successfully", args...)
Expand All @@ -114,7 +114,7 @@ func (lm *loggingMiddleware) ViewProfile(ctx context.Context, token string) (c m
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("View profile failed to complete successfully", args...)
lm.logger.Warn("View profile failed to complete successfully", args...)
return
}
lm.logger.Info("View profile completed successfully", args...)
Expand All @@ -136,7 +136,7 @@ func (lm *loggingMiddleware) ListClients(ctx context.Context, token string, pm m
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("List clients failed to complete successfully", args...)
lm.logger.Warn("List clients failed to complete successfully", args...)
return
}
lm.logger.Info("List clients completed successfully", args...)
Expand All @@ -154,7 +154,7 @@ func (lm *loggingMiddleware) UpdateClient(ctx context.Context, token string, cli
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Update client failed to complete successfully", args...)
lm.logger.Warn("Update client failed to complete successfully", args...)
return
}
lm.logger.Info("Update client completed successfully", args...)
Expand All @@ -172,7 +172,7 @@ func (lm *loggingMiddleware) UpdateClientTags(ctx context.Context, token string,
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Update client tags failed to complete successfully", args...)
lm.logger.Warn("Update client tags failed to complete successfully", args...)
return
}
lm.logger.Info("Update client tags completed successfully", args...)
Expand All @@ -190,7 +190,7 @@ func (lm *loggingMiddleware) UpdateClientIdentity(ctx context.Context, token, id
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Update client identity failed to complete successfully", args...)
lm.logger.Warn("Update client identity failed to complete successfully", args...)
return
}
lm.logger.Info("Update client identity completed successfully", args...)
Expand All @@ -208,7 +208,7 @@ func (lm *loggingMiddleware) UpdateClientSecret(ctx context.Context, token, oldS
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Update client secret failed to complete successfully", args...)
lm.logger.Warn("Update client secret failed to complete successfully", args...)
return
}
lm.logger.Info("Update client secret completed successfully", args...)
Expand All @@ -225,7 +225,7 @@ func (lm *loggingMiddleware) GenerateResetToken(ctx context.Context, email, host
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Generate reset token failed to complete successfully", args...)
lm.logger.Warn("Generate reset token failed to complete successfully", args...)
return
}
lm.logger.Info("Generate reset token completed successfully", args...)
Expand All @@ -242,7 +242,7 @@ func (lm *loggingMiddleware) ResetSecret(ctx context.Context, token, secret stri
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Reset secret failed to complete successfully", args...)
lm.logger.Warn("Reset secret failed to complete successfully", args...)
return
}
lm.logger.Info("Reset secret completed successfully", args...)
Expand All @@ -259,7 +259,7 @@ func (lm *loggingMiddleware) SendPasswordReset(ctx context.Context, host, email,
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Send password reset failed to complete successfully", args...)
lm.logger.Warn("Send password reset failed to complete successfully", args...)
return
}
lm.logger.Info("Send password reset completed successfully", args...)
Expand All @@ -277,7 +277,7 @@ func (lm *loggingMiddleware) UpdateClientRole(ctx context.Context, token string,
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Update client role failed to complete successfully", args...)
lm.logger.Warn("Update client role failed to complete successfully", args...)
return
}
lm.logger.Info("Update client role completed successfully", args...)
Expand All @@ -295,7 +295,7 @@ func (lm *loggingMiddleware) EnableClient(ctx context.Context, token, id string)
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Enable client failed to complete successfully", args...)
lm.logger.Warn("Enable client failed to complete successfully", args...)
return
}
lm.logger.Info("Enable client completed successfully", args...)
Expand All @@ -313,7 +313,7 @@ func (lm *loggingMiddleware) DisableClient(ctx context.Context, token, id string
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Disable client failed to complete successfully", args...)
lm.logger.Warn("Disable client failed to complete successfully", args...)
return
}
lm.logger.Info("Disable client completed successfully", args...)
Expand All @@ -337,7 +337,7 @@ func (lm *loggingMiddleware) ListMembers(ctx context.Context, token, objectKind,
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("List members failed to complete successfully", args...)
lm.logger.Warn("List members failed to complete successfully", args...)
return
}
lm.logger.Info("List members completed successfully", args...)
Expand All @@ -353,7 +353,7 @@ func (lm *loggingMiddleware) Identify(ctx context.Context, token string) (id str
}
if err != nil {
args = append(args, slog.String("error", err.Error()))
lm.logger.Error("Identify failed to complete successfully", args...)
lm.logger.Warn("Identify failed to complete successfully", args...)
return
}
lm.logger.Info("Identify completed successfully", args...)
Expand Down

0 comments on commit 3007c66

Please sign in to comment.