diff --git a/consumers/messages.go b/consumers/messages.go index a635547be29..39d15c09076 100644 --- a/consumers/messages.go +++ b/consumers/messages.go @@ -36,7 +36,7 @@ var ( func Start(ctx context.Context, id string, sub messaging.Subscriber, consumer interface{}, configPath string, logger *slog.Logger) error { cfg, err := loadConfig(configPath) if err != nil { - logger.Warn(fmt.Sprintf("Failed to load consumer config: %s", err)) + logger.Error(fmt.Sprintf("Failed to load consumer config: %s", err)) } transformer := makeTransformer(cfg.TransformerCfg, logger) diff --git a/consumers/notifiers/api/logging.go b/consumers/notifiers/api/logging.go index 50b3bffa2d9..599df8c2e92 100644 --- a/consumers/notifiers/api/logging.go +++ b/consumers/notifiers/api/logging.go @@ -38,7 +38,7 @@ func (lm *loggingMiddleware) CreateSubscription(ctx context.Context, token strin } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Create subscription failed to complete successfully", args...) + lm.logger.Error("Create subscription failed to complete successfully", args...) return } lm.logger.Info("Create subscription completed successfully", args...) @@ -103,7 +103,7 @@ func (lm *loggingMiddleware) RemoveSubscription(ctx context.Context, token, id s } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Remove subscription failed to complete successfully", args...) + lm.logger.Error("Remove subscription failed to complete successfully", args...) return } lm.logger.Info("Remove subscription completed successfully", args...) diff --git a/internal/groups/api/logging.go b/internal/groups/api/logging.go index 5f7befc15d7..a21e195108d 100644 --- a/internal/groups/api/logging.go +++ b/internal/groups/api/logging.go @@ -36,7 +36,7 @@ func (lm *loggingMiddleware) CreateGroup(ctx context.Context, token, kind string } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Create group failed to complete successfully", args...) + lm.logger.Error("Create group failed to complete successfully", args...) return } lm.logger.Info("Create group completed successfully", args...) @@ -58,7 +58,7 @@ func (lm *loggingMiddleware) UpdateGroup(ctx context.Context, token string, grou } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update group failed to complete successfully", args...) + lm.logger.Error("Update group failed to complete successfully", args...) return } lm.logger.Info("Update group completed successfully", args...) @@ -144,7 +144,7 @@ func (lm *loggingMiddleware) EnableGroup(ctx context.Context, token, id string) } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Enable group failed to complete successfully", args...) + lm.logger.Error("Enable group failed to complete successfully", args...) return } lm.logger.Info("Enable group completed successfully", args...) @@ -165,7 +165,7 @@ func (lm *loggingMiddleware) DisableGroup(ctx context.Context, token, id string) } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Disable group failed to complete successfully", args...) + lm.logger.Error("Disable group failed to complete successfully", args...) return } lm.logger.Info("Disable group completed successfully", args...) @@ -204,7 +204,7 @@ func (lm *loggingMiddleware) Assign(ctx context.Context, token, groupID, relatio } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Assign member to group failed to complete successfully", args...) + lm.logger.Error("Assign member to group failed to complete successfully", args...) return } lm.logger.Info("Assign member to group completed successfully", args...) @@ -224,7 +224,7 @@ func (lm *loggingMiddleware) Unassign(ctx context.Context, token, groupID, relat } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Unassign member to group failed to complete successfully", args...) + lm.logger.Error("Unassign member to group failed to complete successfully", args...) return } lm.logger.Info("Unassign member to group completed successfully", args...) @@ -241,7 +241,7 @@ func (lm *loggingMiddleware) DeleteGroup(ctx context.Context, token, id string) } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Delete group failed to complete successfully", args...) + lm.logger.Error("Delete group failed to complete successfully", args...) return } lm.logger.Info("Delete group completed successfully", args...) diff --git a/invitations/middleware/logging.go b/invitations/middleware/logging.go index 6acf135eedc..3c3c50ab806 100644 --- a/invitations/middleware/logging.go +++ b/invitations/middleware/logging.go @@ -31,7 +31,7 @@ func (lm *logging) SendInvitation(ctx context.Context, token string, invitation } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Send invitation failed to complete successfully", args...) + lm.logger.Error("Send invitation failed to complete successfully", args...) return } lm.logger.Info("Send invitation completed successfully", args...) @@ -84,7 +84,7 @@ func (lm *logging) AcceptInvitation(ctx context.Context, token, domainID string) } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Accept invitation failed to complete successfully", args...) + lm.logger.Error("Accept invitation failed to complete successfully", args...) return } lm.logger.Info("Accept invitation completed successfully", args...) @@ -101,7 +101,7 @@ func (lm *logging) DeleteInvitation(ctx context.Context, token, userID, domainID } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Delete invitation failed to complete successfully", args...) + lm.logger.Error("Delete invitation failed to complete successfully", args...) return } lm.logger.Info("Delete invitation completed successfully", args...) diff --git a/lora/api/logging.go b/lora/api/logging.go index 8190e700c84..ad9b678ad26 100644 --- a/lora/api/logging.go +++ b/lora/api/logging.go @@ -37,7 +37,7 @@ func (lm loggingMiddleware) CreateThing(ctx context.Context, thingID, loraDevEUI } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Create thing route-map failed to complete successfully", args...) + lm.logger.Error("Create thing route-map failed to complete successfully", args...) return } lm.logger.Info("Create thing route-map completed successfully", args...) @@ -55,7 +55,7 @@ func (lm loggingMiddleware) UpdateThing(ctx context.Context, thingID, loraDevEUI } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update thing route-map failed to complete successfully", args...) + lm.logger.Error("Update thing route-map failed to complete successfully", args...) return } lm.logger.Info("Update thing route-map completed successfully", args...) @@ -72,7 +72,7 @@ func (lm loggingMiddleware) RemoveThing(ctx context.Context, thingID string) (er } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Remove thing route-map failed to complete successfully", args...) + lm.logger.Error("Remove thing route-map failed to complete successfully", args...) return } lm.logger.Info("Remove thing route-map completed successfully", args...) @@ -90,7 +90,7 @@ func (lm loggingMiddleware) CreateChannel(ctx context.Context, chanID, loraApp s } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Create channel route-map failed to complete successfully", args...) + lm.logger.Error("Create channel route-map failed to complete successfully", args...) return } lm.logger.Info("Create channel route-map completed successfully", args...) @@ -107,7 +107,7 @@ func (lm loggingMiddleware) UpdateChannel(ctx context.Context, chanID, loraApp s slog.String("lora_app", loraApp), } if err != nil { - lm.logger.Warn("Update channel route-map failed to complete successfully", args...) + lm.logger.Error("Update channel route-map failed to complete successfully", args...) return } lm.logger.Info("Update channel route-map completed successfully", args...) @@ -123,7 +123,7 @@ func (lm loggingMiddleware) RemoveChannel(ctx context.Context, chanID string) (e slog.String("channel_id", chanID), } if err != nil { - lm.logger.Warn("Remove channel route-map failed to complete successfully", args...) + lm.logger.Error("Remove channel route-map failed to complete successfully", args...) return } lm.logger.Info("Remove channel route-map completed successfully", args...) @@ -141,7 +141,7 @@ func (lm loggingMiddleware) ConnectThing(ctx context.Context, chanID, thingID st } if err != nil { args := append(args, slog.String("error", err.Error())) - lm.logger.Warn("Connect thing to channel failed to complete successfully", args...) + lm.logger.Error("Connect thing to channel failed to complete successfully", args...) return } lm.logger.Info("Connect thing to channel completed successfully", args...) diff --git a/opcua/api/logging.go b/opcua/api/logging.go index fc728bc9080..e5d67d9803f 100644 --- a/opcua/api/logging.go +++ b/opcua/api/logging.go @@ -37,7 +37,7 @@ func (lm loggingMiddleware) CreateThing(ctx context.Context, mgxThing, opcuaNode } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Create thing route-map failed to complete successfully", args...) + lm.logger.Error("Create thing route-map failed to complete successfully", args...) return } lm.logger.Info("Create thing route-map completed successfully", args...) @@ -55,7 +55,7 @@ func (lm loggingMiddleware) UpdateThing(ctx context.Context, mgxThing, opcuaNode } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update thing route-map failed to complete successfully", args...) + lm.logger.Error("Update thing route-map failed to complete successfully", args...) return } lm.logger.Info("Update thing route-map completed successfully", args...) @@ -72,7 +72,7 @@ func (lm loggingMiddleware) RemoveThing(ctx context.Context, mgxThing string) (e } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Remove thing route-map failed to complete successfully", args...) + lm.logger.Error("Remove thing route-map failed to complete successfully", args...) return } lm.logger.Info("Remove thing route-map completed successfully", args...) @@ -90,7 +90,7 @@ func (lm loggingMiddleware) CreateChannel(ctx context.Context, mgxChan, opcuaSer } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Create channel route-map failed to complete successfully", args...) + lm.logger.Error("Create channel route-map failed to complete successfully", args...) return } lm.logger.Info("Create channel route-map completed successfully", args...) @@ -108,7 +108,7 @@ func (lm loggingMiddleware) UpdateChannel(ctx context.Context, mgxChanID, opcuaS } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update channel route-map failed to complete successfully", args...) + lm.logger.Error("Update channel route-map failed to complete successfully", args...) return } lm.logger.Info("Update channel route-map completed successfully", args...) @@ -125,7 +125,7 @@ func (lm loggingMiddleware) RemoveChannel(ctx context.Context, mgxChanID string) } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Remove channel route-map failed to complete successfully", args...) + lm.logger.Error("Remove channel route-map failed to complete successfully", args...) return } lm.logger.Info("Remove channel route-map completed successfully", args...) @@ -143,7 +143,7 @@ func (lm loggingMiddleware) ConnectThing(ctx context.Context, mgxChanID string, } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Connect thing to channel failed to complete successfully", args...) + lm.logger.Error("Connect thing to channel failed to complete successfully", args...) return } lm.logger.Info("Connect thing to channel completed successfully", args...) @@ -161,7 +161,7 @@ func (lm loggingMiddleware) DisconnectThing(ctx context.Context, mgxChanID strin } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Disconnect thing from channel failed to complete successfully", args...) + lm.logger.Error("Disconnect thing from channel failed to complete successfully", args...) return } lm.logger.Info("Disconnect thing from channel completed successfully", args...) diff --git a/provision/api/logging.go b/provision/api/logging.go index c6aa58fbc05..b7ed75c732f 100644 --- a/provision/api/logging.go +++ b/provision/api/logging.go @@ -33,7 +33,7 @@ func (lm *loggingMiddleware) Provision(token, name, externalID, externalKey stri } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Provision failed to complete successfully", args...) + lm.logger.Error("Provision failed to complete successfully", args...) return } lm.logger.Info("Provision completed successfully", args...) @@ -51,7 +51,7 @@ func (lm *loggingMiddleware) Cert(token, thingID, duration string) (cert, key st } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Thing certificate failed to create successfully", args...) + lm.logger.Error("Thing certificate failed to create successfully", args...) return } lm.logger.Info("Thing certificate created successfully", args...) @@ -67,7 +67,7 @@ func (lm *loggingMiddleware) Mapping(token string) (res map[string]interface{}, } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Mapping failed to complete successfully", args...) + lm.logger.Error("Mapping failed to complete successfully", args...) return } lm.logger.Info("Mapping completed successfully", args...) diff --git a/things/api/logging.go b/things/api/logging.go index 86ae5680385..219f3500dcb 100644 --- a/things/api/logging.go +++ b/things/api/logging.go @@ -32,7 +32,7 @@ func (lm *loggingMiddleware) CreateThings(ctx context.Context, token string, cli } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn(fmt.Sprintf("Create %d things failed to complete successfully", len(clients)), args...) + lm.logger.Error(fmt.Sprintf("Create %d things failed to complete successfully", len(clients)), args...) return } lm.logger.Info(fmt.Sprintf("Create %d things completed successfully", len(clients)), args...) @@ -108,7 +108,7 @@ func (lm *loggingMiddleware) UpdateClient(ctx context.Context, token string, cli } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update thing failed to complete successfully", args...) + lm.logger.Error("Update thing failed to complete successfully", args...) return } lm.logger.Info("Update thing completed successfully", args...) @@ -128,7 +128,7 @@ func (lm *loggingMiddleware) UpdateClientTags(ctx context.Context, token string, } if err != nil { args := append(args, slog.String("error", err.Error())) - lm.logger.Warn("Update thing tags failed to complete successfully", args...) + lm.logger.Error("Update thing tags failed to complete successfully", args...) return } lm.logger.Info("Update thing tags completed successfully", args...) @@ -147,7 +147,7 @@ func (lm *loggingMiddleware) UpdateClientSecret(ctx context.Context, token, oldS } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update thing secret failed to complete successfully", args...) + lm.logger.Error("Update thing secret failed to complete successfully", args...) return } lm.logger.Info("Update thing secret completed successfully", args...) @@ -166,7 +166,7 @@ func (lm *loggingMiddleware) EnableClient(ctx context.Context, token, id string) } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Enable thing failed to complete successfully", args...) + lm.logger.Error("Enable thing failed to complete successfully", args...) return } lm.logger.Info("Enable thing completed successfully", args...) @@ -185,7 +185,7 @@ func (lm *loggingMiddleware) DisableClient(ctx context.Context, token, id string } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Disable thing failed to complete successfully", args...) + lm.logger.Error("Disable thing failed to complete successfully", args...) return } lm.logger.Info("Disable thing completed successfully", args...) @@ -222,7 +222,7 @@ func (lm *loggingMiddleware) Identify(ctx context.Context, key string) (id strin } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Identify thing failed to complete successfully", args...) + lm.logger.Error("Identify thing failed to complete successfully", args...) return } lm.logger.Info("Identify thing completed successfully", args...) @@ -241,7 +241,7 @@ func (lm *loggingMiddleware) Authorize(ctx context.Context, req *magistrala.Auth } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Authorize failed to complete successfully", args...) + lm.logger.Error("Authorize failed to complete successfully", args...) return } lm.logger.Info("Authorize completed successfully", args...) @@ -293,7 +293,7 @@ func (lm *loggingMiddleware) DeleteClient(ctx context.Context, token, id string) } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Delete thing failed to complete successfully", args...) + lm.logger.Error("Delete thing failed to complete successfully", args...) return } lm.logger.Info("Delete thing completed successfully", args...) diff --git a/twins/api/logging.go b/twins/api/logging.go index eff62e13a6d..0836505514d 100644 --- a/twins/api/logging.go +++ b/twins/api/logging.go @@ -38,7 +38,7 @@ func (lm *loggingMiddleware) AddTwin(ctx context.Context, token string, twin twi } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Add twin failed to complete successfully", args...) + lm.logger.Error("Add twin failed to complete successfully", args...) return } lm.logger.Info("Add twin completed successfully", args...) @@ -59,7 +59,7 @@ func (lm *loggingMiddleware) UpdateTwin(ctx context.Context, token string, twin } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update twin failed to complete successfully", args...) + lm.logger.Error("Update twin failed to complete successfully", args...) return } lm.logger.Info("Update twin completed successfully", args...) @@ -119,7 +119,7 @@ func (lm *loggingMiddleware) SaveStates(ctx context.Context, msg *messaging.Mess } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Save states failed to complete successfully", args...) + lm.logger.Error("Save states failed to complete successfully", args...) return } lm.logger.Info("Save states completed successfully", args...) @@ -158,7 +158,7 @@ func (lm *loggingMiddleware) RemoveTwin(ctx context.Context, token, twinID strin } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Remove twin failed to complete successfully", args...) + lm.logger.Error("Remove twin failed to complete successfully", args...) return } lm.logger.Info("Remove twin completed successfully", args...) diff --git a/users/api/logging.go b/users/api/logging.go index 6d43161d614..483414d8873 100644 --- a/users/api/logging.go +++ b/users/api/logging.go @@ -39,7 +39,7 @@ func (lm *loggingMiddleware) RegisterClient(ctx context.Context, token string, c } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Register user failed to complete successfully", args...) + lm.logger.Error("Register user failed to complete successfully", args...) return } lm.logger.Info("Register user completed successfully", args...) @@ -60,7 +60,7 @@ func (lm *loggingMiddleware) IssueToken(ctx context.Context, identity, secret, d } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Issue token failed to complete successfully", args...) + lm.logger.Error("Issue token failed to complete successfully", args...) return } lm.logger.Info("Issue token completed successfully", args...) @@ -81,7 +81,7 @@ func (lm *loggingMiddleware) RefreshToken(ctx context.Context, refreshToken, dom } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Refresh token failed to complete successfully", args...) + lm.logger.Error("Refresh token failed to complete successfully", args...) return } lm.logger.Info("Refresh token completed successfully", args...) @@ -167,7 +167,7 @@ func (lm *loggingMiddleware) UpdateClient(ctx context.Context, token string, cli } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update user failed to complete successfully", args...) + lm.logger.Error("Update user failed to complete successfully", args...) return } lm.logger.Info("Update user completed successfully", args...) @@ -189,7 +189,7 @@ func (lm *loggingMiddleware) UpdateClientTags(ctx context.Context, token string, } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update user tags failed to complete successfully", args...) + lm.logger.Error("Update user tags failed to complete successfully", args...) return } lm.logger.Info("Update user tags completed successfully", args...) @@ -210,7 +210,7 @@ func (lm *loggingMiddleware) UpdateClientIdentity(ctx context.Context, token, id } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update client identity failed to complete successfully", args...) + lm.logger.Error("Update client identity failed to complete successfully", args...) return } lm.logger.Info("Update client identity completed successfully", args...) @@ -231,7 +231,7 @@ func (lm *loggingMiddleware) UpdateClientSecret(ctx context.Context, token, oldS } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update user secret failed to complete successfully", args...) + lm.logger.Error("Update user secret failed to complete successfully", args...) return } lm.logger.Info("Update user secret completed successfully", args...) @@ -249,7 +249,7 @@ func (lm *loggingMiddleware) GenerateResetToken(ctx context.Context, email, host } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Generate reset token failed to complete successfully", args...) + lm.logger.Error("Generate reset token failed to complete successfully", args...) return } lm.logger.Info("Generate reset token completed successfully", args...) @@ -306,7 +306,7 @@ func (lm *loggingMiddleware) UpdateClientRole(ctx context.Context, token string, } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Update user role failed to complete successfully", args...) + lm.logger.Error("Update user role failed to complete successfully", args...) return } lm.logger.Info("Update user role completed successfully", args...) @@ -327,7 +327,7 @@ func (lm *loggingMiddleware) EnableClient(ctx context.Context, token, id string) } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Enable user failed to complete successfully", args...) + lm.logger.Error("Enable user failed to complete successfully", args...) return } lm.logger.Info("Enable user completed successfully", args...) @@ -348,7 +348,7 @@ func (lm *loggingMiddleware) DisableClient(ctx context.Context, token, id string } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Disable user failed to complete successfully", args...) + lm.logger.Error("Disable user failed to complete successfully", args...) return } lm.logger.Info("Disable user completed successfully", args...) @@ -391,7 +391,7 @@ func (lm *loggingMiddleware) Identify(ctx context.Context, token string) (id str } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Identify user failed to complete successfully", args...) + lm.logger.Error("Identify user failed to complete successfully", args...) return } lm.logger.Info("Identify user completed successfully", args...) @@ -408,7 +408,7 @@ func (lm *loggingMiddleware) OAuthCallback(ctx context.Context, state mgoauth2.S } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("OAuth callback failed to complete successfully", args...) + lm.logger.Error("OAuth callback failed to complete successfully", args...) return } lm.logger.Info("OAuth callback completed successfully", args...) diff --git a/ws/api/logging.go b/ws/api/logging.go index 7ecce696fad..8b5881ff03b 100644 --- a/ws/api/logging.go +++ b/ws/api/logging.go @@ -36,7 +36,7 @@ func (lm *loggingMiddleware) Subscribe(ctx context.Context, thingKey, chanID, su } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Subscibe failed to complete successfully", args...) + lm.logger.Error("Subscibe failed to complete successfully", args...) return } lm.logger.Info("Subscribe completed successfully", args...)