diff --git a/auth/api/logging.go b/auth/api/logging.go index fec43fd28..871485f3e 100644 --- a/auth/api/logging.go +++ b/auth/api/logging.go @@ -27,7 +27,7 @@ func LoggingMiddleware(svc auth.Service, logger *slog.Logger) auth.Service { func (lm *loggingMiddleware) ListObjects(ctx context.Context, pr auth.PolicyReq, nextPageToken string, limit int32) (p auth.PolicyPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Int64("limit", int64(limit)), } @@ -44,16 +44,13 @@ func (lm *loggingMiddleware) ListObjects(ctx context.Context, pr auth.PolicyReq, func (lm *loggingMiddleware) ListAllObjects(ctx context.Context, pr auth.PolicyReq) (p auth.PolicyPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( - "object", - slog.String("type", pr.ObjectType), - ), - slog.Group( - "subject", - slog.String("id", pr.Subject), - slog.String("type", pr.SubjectType), + "policy_request", + slog.String("object_type", pr.ObjectType), + slog.String("subject_id", pr.Subject), + slog.String("subject_type", pr.SubjectType), ), slog.String("permission", pr.Permission), } @@ -70,7 +67,7 @@ func (lm *loggingMiddleware) ListAllObjects(ctx context.Context, pr auth.PolicyR func (lm *loggingMiddleware) CountObjects(ctx context.Context, pr auth.PolicyReq) (count int, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "object", @@ -91,16 +88,13 @@ func (lm *loggingMiddleware) CountObjects(ctx context.Context, pr auth.PolicyReq func (lm *loggingMiddleware) ListSubjects(ctx context.Context, pr auth.PolicyReq, nextPageToken string, limit int32) (p auth.PolicyPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( - "subject", - slog.String("type", pr.SubjectType), - ), - slog.Group( - "object", - slog.String("id", pr.Object), - slog.String("type", pr.ObjectType), + "policy_request", + slog.String("subject_type", pr.SubjectType), + slog.String("object_id", pr.Object), + slog.String("object_type", pr.ObjectType), ), slog.String("permission", pr.Permission), } @@ -117,16 +111,13 @@ func (lm *loggingMiddleware) ListSubjects(ctx context.Context, pr auth.PolicyReq func (lm *loggingMiddleware) ListAllSubjects(ctx context.Context, pr auth.PolicyReq) (p auth.PolicyPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( - "subject", - slog.String("type", pr.SubjectType), - ), - slog.Group( - "object", - slog.String("id", pr.Object), - slog.String("type", pr.ObjectType), + "policy_request", + slog.String("sybject_type", pr.SubjectType), + slog.String("object_id", pr.Object), + slog.String("object_type", pr.ObjectType), ), slog.String("permission", pr.Permission), } @@ -143,7 +134,7 @@ func (lm *loggingMiddleware) ListAllSubjects(ctx context.Context, pr auth.Policy func (lm *loggingMiddleware) CountSubjects(ctx context.Context, pr auth.PolicyReq) (count int, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "subject", @@ -163,18 +154,15 @@ func (lm *loggingMiddleware) CountSubjects(ctx context.Context, pr auth.PolicyRe func (lm *loggingMiddleware) ListPermissions(ctx context.Context, pr auth.PolicyReq, filterPermissions []string) (p auth.Permissions, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Any("filter_permissions", filterPermissions), slog.Group( - "object", - slog.String("id", pr.Object), - slog.String("type", pr.ObjectType), - ), - slog.Group( - "subject", - slog.String("id", pr.Subject), - slog.String("type", pr.SubjectType), + "policy_request", + slog.String("object_id", pr.Object), + slog.String("object_type", pr.ObjectType), + slog.String("subject_id", pr.Subject), + slog.String("subject_type", pr.SubjectType), ), } if err != nil { @@ -190,7 +178,7 @@ func (lm *loggingMiddleware) ListPermissions(ctx context.Context, pr auth.Policy func (lm *loggingMiddleware) Issue(ctx context.Context, token string, key auth.Key) (tkn auth.Token, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "key", @@ -214,7 +202,7 @@ func (lm *loggingMiddleware) Issue(ctx context.Context, token string, key auth.K func (lm *loggingMiddleware) Revoke(ctx context.Context, token, id string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -231,7 +219,7 @@ func (lm *loggingMiddleware) Revoke(ctx context.Context, token, id string) (err func (lm *loggingMiddleware) RetrieveKey(ctx context.Context, token, id string) (key auth.Key, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -248,7 +236,7 @@ func (lm *loggingMiddleware) RetrieveKey(ctx context.Context, token, id string) func (lm *loggingMiddleware) Identify(ctx context.Context, token string) (id auth.Key, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), } if err != nil { @@ -264,7 +252,7 @@ func (lm *loggingMiddleware) Identify(ctx context.Context, token string) (id aut func (lm *loggingMiddleware) Authorize(ctx context.Context, pr auth.PolicyReq) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "object", @@ -290,17 +278,14 @@ func (lm *loggingMiddleware) Authorize(ctx context.Context, pr auth.PolicyReq) ( func (lm *loggingMiddleware) AddPolicy(ctx context.Context, pr auth.PolicyReq) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( - "object", - slog.String("id", pr.Object), - slog.String("type", pr.ObjectType), - ), - slog.Group( - "subject", - slog.String("id", pr.Subject), - slog.String("type", pr.SubjectType), + "policy_request", + slog.String("object_id", pr.Object), + slog.String("object_type", pr.ObjectType), + slog.String("subject_id", pr.Subject), + slog.String("subject_type", pr.SubjectType), ), slog.String("permission", pr.Permission), } @@ -316,17 +301,14 @@ func (lm *loggingMiddleware) AddPolicy(ctx context.Context, pr auth.PolicyReq) ( func (lm *loggingMiddleware) AddPolicies(ctx context.Context, prs []auth.PolicyReq) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( - "subject", - slog.String("id", prs[0].Subject), - slog.String("type", prs[0].SubjectType), - ), - slog.Group( - "object", - slog.String("id", prs[0].Object), - slog.String("type", prs[0].ObjectType), + "policy_request", + slog.String("subject_id", prs[0].Subject), + slog.String("subject_type", prs[0].SubjectType), + slog.String("object_id", prs[0].Object), + slog.String("object_type", prs[0].ObjectType), ), slog.String("permission", prs[0].Permission), } @@ -343,17 +325,14 @@ func (lm *loggingMiddleware) AddPolicies(ctx context.Context, prs []auth.PolicyR func (lm *loggingMiddleware) DeletePolicy(ctx context.Context, pr auth.PolicyReq) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( - "object", - slog.String("id", pr.Object), - slog.String("type", pr.ObjectType), - ), - slog.Group( - "subject", - slog.String("id", pr.Subject), - slog.String("type", pr.SubjectType), + "policy_request", + slog.String("object_id", pr.Object), + slog.String("object_type", pr.ObjectType), + slog.String("subject_id", pr.Subject), + slog.String("subject_type", pr.SubjectType), ), slog.String("permission", pr.Permission), } @@ -369,17 +348,14 @@ func (lm *loggingMiddleware) DeletePolicy(ctx context.Context, pr auth.PolicyReq func (lm *loggingMiddleware) DeletePolicies(ctx context.Context, prs []auth.PolicyReq) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( - "subject", - slog.String("id", prs[0].Subject), - slog.String("type", prs[0].SubjectType), - ), - slog.Group( - "object", - slog.String("id", prs[0].Object), - slog.String("type", prs[0].ObjectType), + "policy_request", + slog.String("subject_id", prs[0].Subject), + slog.String("subject_type", prs[0].SubjectType), + slog.String("object_id", prs[0].Object), + slog.String("object_type", prs[0].ObjectType), ), slog.String("permission", prs[0].Permission), } @@ -395,7 +371,7 @@ func (lm *loggingMiddleware) DeletePolicies(ctx context.Context, prs []auth.Poli func (lm *loggingMiddleware) CreateDomain(ctx context.Context, token string, d auth.Domain) (do auth.Domain, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "domain", @@ -415,7 +391,7 @@ func (lm *loggingMiddleware) CreateDomain(ctx context.Context, token string, d a func (lm *loggingMiddleware) RetrieveDomain(ctx context.Context, token, id string) (do auth.Domain, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("domain_id", id), } @@ -431,7 +407,7 @@ func (lm *loggingMiddleware) RetrieveDomain(ctx context.Context, token, id strin func (lm *loggingMiddleware) RetrieveDomainPermissions(ctx context.Context, token, id string) (permissions auth.Permissions, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("domain_id", id), } @@ -447,7 +423,7 @@ func (lm *loggingMiddleware) RetrieveDomainPermissions(ctx context.Context, toke func (lm *loggingMiddleware) UpdateDomain(ctx context.Context, token, id string, d auth.DomainReq) (do auth.Domain, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "domain", @@ -467,7 +443,7 @@ func (lm *loggingMiddleware) UpdateDomain(ctx context.Context, token, id string, func (lm *loggingMiddleware) ChangeDomainStatus(ctx context.Context, token, id string, d auth.DomainReq) (do auth.Domain, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "domain", @@ -487,7 +463,7 @@ func (lm *loggingMiddleware) ChangeDomainStatus(ctx context.Context, token, id s func (lm *loggingMiddleware) ListDomains(ctx context.Context, token string, page auth.Page) (do auth.DomainsPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "page", @@ -508,7 +484,7 @@ func (lm *loggingMiddleware) ListDomains(ctx context.Context, token string, page func (lm *loggingMiddleware) AssignUsers(ctx context.Context, token, id string, userIds []string, relation string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), slog.String("relation", relation), @@ -526,7 +502,7 @@ func (lm *loggingMiddleware) AssignUsers(ctx context.Context, token, id string, func (lm *loggingMiddleware) UnassignUsers(ctx context.Context, token, id string, userIds []string, relation string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), slog.String("relation", relation), @@ -544,7 +520,7 @@ func (lm *loggingMiddleware) UnassignUsers(ctx context.Context, token, id string func (lm *loggingMiddleware) ListUserDomains(ctx context.Context, token, userID string, page auth.Page) (do auth.DomainsPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("user_id", userID), } diff --git a/bootstrap/api/logging.go b/bootstrap/api/logging.go index 55ac85846..17161c9f0 100644 --- a/bootstrap/api/logging.go +++ b/bootstrap/api/logging.go @@ -29,7 +29,7 @@ func LoggingMiddleware(svc bootstrap.Service, logger *slog.Logger) bootstrap.Ser // If the request fails, it logs the error. func (lm *loggingMiddleware) Add(ctx context.Context, token string, cfg bootstrap.Config) (saved bootstrap.Config, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", saved.ThingID), } @@ -48,7 +48,7 @@ func (lm *loggingMiddleware) Add(ctx context.Context, token string, cfg bootstra // If the request fails, it logs the error. func (lm *loggingMiddleware) View(ctx context.Context, token, id string) (saved bootstrap.Config, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", id), } @@ -67,7 +67,7 @@ func (lm *loggingMiddleware) View(ctx context.Context, token, id string) (saved // If the request fails, it logs the error. func (lm *loggingMiddleware) Update(ctx context.Context, token string, cfg bootstrap.Config) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", cfg.ThingID), } @@ -86,7 +86,7 @@ func (lm *loggingMiddleware) Update(ctx context.Context, token string, cfg boots // If the request fails, it logs the error. func (lm *loggingMiddleware) UpdateCert(ctx context.Context, token, thingID, clientCert, clientKey, caCert string) (cfg bootstrap.Config, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", cfg.ThingID), } @@ -105,7 +105,7 @@ func (lm *loggingMiddleware) UpdateCert(ctx context.Context, token, thingID, cli // If the request fails, it logs the error. func (lm *loggingMiddleware) UpdateConnections(ctx context.Context, token, id string, connections []string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -124,7 +124,7 @@ func (lm *loggingMiddleware) UpdateConnections(ctx context.Context, token, id st // If the request fails, it logs the error. func (lm *loggingMiddleware) List(ctx context.Context, token string, filter bootstrap.Filter, offset, limit uint64) (res bootstrap.ConfigsPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "filter", @@ -147,7 +147,7 @@ func (lm *loggingMiddleware) List(ctx context.Context, token string, filter boot // If the request fails, it logs the error. func (lm *loggingMiddleware) Remove(ctx context.Context, token, id string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -164,7 +164,7 @@ func (lm *loggingMiddleware) Remove(ctx context.Context, token, id string) (err func (lm *loggingMiddleware) Bootstrap(ctx context.Context, externalKey, externalID string, secure bool) (cfg bootstrap.Config, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "config", @@ -184,7 +184,7 @@ func (lm *loggingMiddleware) Bootstrap(ctx context.Context, externalKey, externa func (lm *loggingMiddleware) ChangeState(ctx context.Context, token, id string, state bootstrap.State) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), slog.Any("state", state), @@ -202,7 +202,7 @@ func (lm *loggingMiddleware) ChangeState(ctx context.Context, token, id string, func (lm *loggingMiddleware) UpdateChannelHandler(ctx context.Context, channel bootstrap.Channel) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "channel", @@ -224,7 +224,7 @@ func (lm *loggingMiddleware) UpdateChannelHandler(ctx context.Context, channel b func (lm *loggingMiddleware) RemoveConfigHandler(ctx context.Context, id string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("config_id", id), } @@ -241,7 +241,7 @@ func (lm *loggingMiddleware) RemoveConfigHandler(ctx context.Context, id string) func (lm *loggingMiddleware) RemoveChannelHandler(ctx context.Context, id string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -258,7 +258,7 @@ func (lm *loggingMiddleware) RemoveChannelHandler(ctx context.Context, id string func (lm *loggingMiddleware) DisconnectThingHandler(ctx context.Context, channelID, thingID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", channelID), slog.String("thing_id", thingID), diff --git a/certs/api/logging.go b/certs/api/logging.go index a6c68116f..c649809ee 100644 --- a/certs/api/logging.go +++ b/certs/api/logging.go @@ -29,7 +29,7 @@ func LoggingMiddleware(svc certs.Service, logger *slog.Logger) certs.Service { // If the request fails, it logs the error. func (lm *loggingMiddleware) IssueCert(ctx context.Context, token, thingID, ttl string) (c certs.Cert, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", thingID), slog.String("ttl", ttl), @@ -48,7 +48,7 @@ func (lm *loggingMiddleware) IssueCert(ctx context.Context, token, thingID, ttl // ListCerts logs the list_certs request. It logs the thing ID and the time it took to complete the request. func (lm *loggingMiddleware) ListCerts(ctx context.Context, token, thingID string, offset, limit uint64) (cp certs.Page, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", thingID), slog.Group( @@ -72,7 +72,7 @@ func (lm *loggingMiddleware) ListCerts(ctx context.Context, token, thingID strin // If the request fails, it logs the error. func (lm *loggingMiddleware) ListSerials(ctx context.Context, token, thingID string, offset, limit uint64) (cp certs.Page, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", thingID), slog.Group( @@ -96,7 +96,7 @@ func (lm *loggingMiddleware) ListSerials(ctx context.Context, token, thingID str // If the request fails, it logs the error. func (lm *loggingMiddleware) ViewCert(ctx context.Context, token, serialID string) (c certs.Cert, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("serial_id", serialID), } @@ -115,7 +115,7 @@ func (lm *loggingMiddleware) ViewCert(ctx context.Context, token, serialID strin // If the request fails, it logs the error. func (lm *loggingMiddleware) RevokeCert(ctx context.Context, token, thingID string) (c certs.Revoke, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", thingID), } diff --git a/coap/api/logging.go b/coap/api/logging.go index c2a562ddb..081811080 100644 --- a/coap/api/logging.go +++ b/coap/api/logging.go @@ -30,7 +30,7 @@ func LoggingMiddleware(svc coap.Service, logger *slog.Logger) coap.Service { // If the request fails, it logs the error. func (lm *loggingMiddleware) Publish(ctx context.Context, key string, msg *messaging.Message) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", msg.GetChannel()), } @@ -52,7 +52,7 @@ func (lm *loggingMiddleware) Publish(ctx context.Context, key string, msg *messa // If the request fails, it logs the error. func (lm *loggingMiddleware) Subscribe(ctx context.Context, key, chanID, subtopic string, c coap.Client) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", chanID), } @@ -74,7 +74,7 @@ func (lm *loggingMiddleware) Subscribe(ctx context.Context, key, chanID, subtopi // If the request fails, it logs the error. func (lm *loggingMiddleware) Unsubscribe(ctx context.Context, key, chanID, subtopic, token string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", chanID), } diff --git a/consumers/notifiers/api/logging.go b/consumers/notifiers/api/logging.go index 337498bdf..9cbc5b001 100644 --- a/consumers/notifiers/api/logging.go +++ b/consumers/notifiers/api/logging.go @@ -29,7 +29,7 @@ func LoggingMiddleware(svc notifiers.Service, logger *slog.Logger) notifiers.Ser // If the request fails, it logs the error. func (lm *loggingMiddleware) CreateSubscription(ctx context.Context, token string, sub notifiers.Subscription) (id string, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "subscription", @@ -52,7 +52,7 @@ func (lm *loggingMiddleware) CreateSubscription(ctx context.Context, token strin // If the request fails, it logs the error. func (lm *loggingMiddleware) ViewSubscription(ctx context.Context, token, topic string) (sub notifiers.Subscription, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "subscription", @@ -75,7 +75,7 @@ func (lm *loggingMiddleware) ViewSubscription(ctx context.Context, token, topic // If the request fails, it logs the error. func (lm *loggingMiddleware) ListSubscriptions(ctx context.Context, token string, pm notifiers.PageMetadata) (res notifiers.Page, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "page", @@ -99,7 +99,7 @@ func (lm *loggingMiddleware) ListSubscriptions(ctx context.Context, token string // If the request fails, it logs the error. func (lm *loggingMiddleware) RemoveSubscription(ctx context.Context, token, id string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -118,7 +118,7 @@ func (lm *loggingMiddleware) RemoveSubscription(ctx context.Context, token, id s // If the request fails, it logs the error. func (lm *loggingMiddleware) ConsumeBlocking(ctx context.Context, msg interface{}) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), } if err != nil { diff --git a/consumers/writers/api/logging.go b/consumers/writers/api/logging.go index 419ad400c..bba75a595 100644 --- a/consumers/writers/api/logging.go +++ b/consumers/writers/api/logging.go @@ -32,7 +32,7 @@ func LoggingMiddleware(consumer consumers.BlockingConsumer, logger *slog.Logger) // If the request fails, it logs the error. func (lm *loggingMiddleware) ConsumeBlocking(ctx context.Context, msgs interface{}) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), } if err != nil { diff --git a/internal/groups/api/logging.go b/internal/groups/api/logging.go index 21cc28a3f..0bfbc2432 100644 --- a/internal/groups/api/logging.go +++ b/internal/groups/api/logging.go @@ -27,7 +27,7 @@ func LoggingMiddleware(svc groups.Service, logger *slog.Logger) groups.Service { // If the request fails, it logs the error. func (lm *loggingMiddleware) CreateGroup(ctx context.Context, token, kind string, group groups.Group) (g groups.Group, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "group", @@ -49,7 +49,7 @@ func (lm *loggingMiddleware) CreateGroup(ctx context.Context, token, kind string // If the request fails, it logs the error. func (lm *loggingMiddleware) UpdateGroup(ctx context.Context, token string, group groups.Group) (g groups.Group, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "group", @@ -72,7 +72,7 @@ func (lm *loggingMiddleware) UpdateGroup(ctx context.Context, token string, grou // If the request fails, it logs the error. func (lm *loggingMiddleware) ViewGroup(ctx context.Context, token, id string) (g groups.Group, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "group", @@ -94,7 +94,7 @@ func (lm *loggingMiddleware) ViewGroup(ctx context.Context, token, id string) (g // If the request fails, it logs the error. func (lm *loggingMiddleware) ViewGroupPerms(ctx context.Context, token, id string) (p []string, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("group_id", id), } @@ -112,7 +112,7 @@ func (lm *loggingMiddleware) ViewGroupPerms(ctx context.Context, token, id strin // If the request fails, it logs the error. func (lm *loggingMiddleware) ListGroups(ctx context.Context, token, memberKind, memberID string, gp groups.Page) (cg groups.Page, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "group", @@ -138,7 +138,7 @@ func (lm *loggingMiddleware) ListGroups(ctx context.Context, token, memberKind, // If the request fails, it logs the error. func (lm *loggingMiddleware) EnableGroup(ctx context.Context, token, id string) (g groups.Group, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "group", @@ -160,7 +160,7 @@ func (lm *loggingMiddleware) EnableGroup(ctx context.Context, token, id string) // If the request fails, it logs the error. func (lm *loggingMiddleware) DisableGroup(ctx context.Context, token, id string) (g groups.Group, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("group_id", id), } @@ -178,7 +178,7 @@ func (lm *loggingMiddleware) DisableGroup(ctx context.Context, token, id string) // If the request fails, it logs the error. func (lm *loggingMiddleware) ListMembers(ctx context.Context, token, groupID, permission, memberKind string) (mp groups.MembersPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "group", @@ -199,7 +199,7 @@ func (lm *loggingMiddleware) ListMembers(ctx context.Context, token, groupID, pe func (lm *loggingMiddleware) Assign(ctx context.Context, token, groupID, relation, memberKind string, memberIDs ...string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("group_id", groupID), slog.String("relation", relation), @@ -219,7 +219,7 @@ func (lm *loggingMiddleware) Assign(ctx context.Context, token, groupID, relatio func (lm *loggingMiddleware) Unassign(ctx context.Context, token, groupID, relation, memberKind string, memberIDs ...string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("group_id", groupID), slog.String("relation", relation), @@ -239,7 +239,7 @@ func (lm *loggingMiddleware) Unassign(ctx context.Context, token, groupID, relat func (lm *loggingMiddleware) DeleteGroup(ctx context.Context, token, id string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("group_id", id), } diff --git a/lora/api/logging.go b/lora/api/logging.go index 821cad3f1..17a023197 100644 --- a/lora/api/logging.go +++ b/lora/api/logging.go @@ -30,7 +30,7 @@ func LoggingMiddleware(svc lora.Service, logger *slog.Logger) lora.Service { func (lm loggingMiddleware) CreateThing(ctx context.Context, thingID, loraDevEUI string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "thing", @@ -51,7 +51,7 @@ func (lm loggingMiddleware) CreateThing(ctx context.Context, thingID, loraDevEUI func (lm loggingMiddleware) UpdateThing(ctx context.Context, thingID, loraDevEUI string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "thing", @@ -72,7 +72,7 @@ func (lm loggingMiddleware) UpdateThing(ctx context.Context, thingID, loraDevEUI func (lm loggingMiddleware) RemoveThing(ctx context.Context, thingID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", thingID), } @@ -89,7 +89,7 @@ func (lm loggingMiddleware) RemoveThing(ctx context.Context, thingID string) (er func (lm loggingMiddleware) CreateChannel(ctx context.Context, chanID, loraApp string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "channel", @@ -110,7 +110,7 @@ func (lm loggingMiddleware) CreateChannel(ctx context.Context, chanID, loraApp s func (lm loggingMiddleware) UpdateChannel(ctx context.Context, chanID, loraApp string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "channel", @@ -130,7 +130,7 @@ func (lm loggingMiddleware) UpdateChannel(ctx context.Context, chanID, loraApp s func (lm loggingMiddleware) RemoveChannel(ctx context.Context, chanID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", chanID), } @@ -146,7 +146,7 @@ func (lm loggingMiddleware) RemoveChannel(ctx context.Context, chanID string) (e func (lm loggingMiddleware) ConnectThing(ctx context.Context, chanID, thingID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", chanID), slog.String("thing_id", thingID), @@ -164,7 +164,7 @@ func (lm loggingMiddleware) ConnectThing(ctx context.Context, chanID, thingID st func (lm loggingMiddleware) DisconnectThing(ctx context.Context, chanID, thingID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", chanID), slog.String("thing_id", thingID), @@ -182,7 +182,7 @@ func (lm loggingMiddleware) DisconnectThing(ctx context.Context, chanID, thingID func (lm loggingMiddleware) Publish(ctx context.Context, msg *lora.Message) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "message", diff --git a/opcua/api/logging.go b/opcua/api/logging.go index 0333093d3..5b653cee9 100644 --- a/opcua/api/logging.go +++ b/opcua/api/logging.go @@ -30,7 +30,7 @@ func LoggingMiddleware(svc opcua.Service, logger *slog.Logger) opcua.Service { func (lm loggingMiddleware) CreateThing(ctx context.Context, mgxThing, opcuaNodeID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "thing", @@ -51,7 +51,7 @@ func (lm loggingMiddleware) CreateThing(ctx context.Context, mgxThing, opcuaNode func (lm loggingMiddleware) UpdateThing(ctx context.Context, mgxThing, opcuaNodeID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "thing", @@ -72,7 +72,7 @@ func (lm loggingMiddleware) UpdateThing(ctx context.Context, mgxThing, opcuaNode func (lm loggingMiddleware) RemoveThing(ctx context.Context, mgxThing string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", mgxThing), } @@ -89,7 +89,7 @@ func (lm loggingMiddleware) RemoveThing(ctx context.Context, mgxThing string) (e func (lm loggingMiddleware) CreateChannel(ctx context.Context, mgxChan, opcuaServerURI string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "channel", @@ -110,7 +110,7 @@ func (lm loggingMiddleware) CreateChannel(ctx context.Context, mgxChan, opcuaSer func (lm loggingMiddleware) UpdateChannel(ctx context.Context, mgxChanID, opcuaServerURI string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "channel", @@ -131,7 +131,7 @@ func (lm loggingMiddleware) UpdateChannel(ctx context.Context, mgxChanID, opcuaS func (lm loggingMiddleware) RemoveChannel(ctx context.Context, mgxChanID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", mgxChanID), } @@ -148,7 +148,7 @@ func (lm loggingMiddleware) RemoveChannel(ctx context.Context, mgxChanID string) func (lm loggingMiddleware) ConnectThing(ctx context.Context, mgxChanID, mgxThingID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", mgxChanID), slog.String("thing_id", mgxThingID), @@ -166,7 +166,7 @@ func (lm loggingMiddleware) ConnectThing(ctx context.Context, mgxChanID, mgxThin func (lm loggingMiddleware) DisconnectThing(ctx context.Context, mgxChanID, mgxThingID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", mgxChanID), slog.String("thing_id", mgxThingID), @@ -184,7 +184,7 @@ func (lm loggingMiddleware) DisconnectThing(ctx context.Context, mgxChanID, mgxT func (lm loggingMiddleware) Browse(ctx context.Context, serverURI, namespace, identifier string) (nodes []opcua.BrowsedNode, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("server_uri", serverURI), slog.String("namespace", namespace), diff --git a/pkg/messaging/handler/logging.go b/pkg/messaging/handler/logging.go index 98a22a36a..d1dda91fa 100644 --- a/pkg/messaging/handler/logging.go +++ b/pkg/messaging/handler/logging.go @@ -68,7 +68,7 @@ func LoggingMiddleware(svc session.Handler, logger *slog.Logger) session.Handler func (lm *loggingMiddleware) logAction(ctx context.Context, action string, topics *[]string, payload *[]byte) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), } if topics != nil { diff --git a/provision/api/logging.go b/provision/api/logging.go index 2d46aeb3f..038f3688b 100644 --- a/provision/api/logging.go +++ b/provision/api/logging.go @@ -26,7 +26,7 @@ func NewLoggingMiddleware(svc provision.Service, logger *slog.Logger) provision. func (lm *loggingMiddleware) Provision(token, name, externalID, externalKey string) (res provision.Result, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), } if err != nil { @@ -42,7 +42,7 @@ func (lm *loggingMiddleware) Provision(token, name, externalID, externalKey stri func (lm *loggingMiddleware) Cert(token, thingID, duration string) (cert, key string, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", thingID), } @@ -59,7 +59,7 @@ func (lm *loggingMiddleware) Cert(token, thingID, duration string) (cert, key st func (lm *loggingMiddleware) Mapping(token string) (res map[string]interface{}, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), } if err != nil { diff --git a/readers/api/logging.go b/readers/api/logging.go index 4b6e910de..c7ea18045 100644 --- a/readers/api/logging.go +++ b/readers/api/logging.go @@ -29,7 +29,7 @@ func LoggingMiddleware(svc readers.MessageRepository, logger *slog.Logger) reade func (lm *loggingMiddleware) ReadAll(chanID string, rpm readers.PageMetadata) (page readers.MessagesPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", chanID), slog.Group( diff --git a/things/api/logging.go b/things/api/logging.go index e8f71d74d..0c3992054 100644 --- a/things/api/logging.go +++ b/things/api/logging.go @@ -26,7 +26,7 @@ func LoggingMiddleware(svc things.Service, logger *slog.Logger) things.Service { func (lm *loggingMiddleware) CreateThings(ctx context.Context, token string, clients ...mgclients.Client) (cs []mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Any("no_of_things", len(clients)), } @@ -42,7 +42,7 @@ func (lm *loggingMiddleware) CreateThings(ctx context.Context, token string, cli func (lm *loggingMiddleware) ViewClient(ctx context.Context, token, id string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -58,7 +58,7 @@ func (lm *loggingMiddleware) ViewClient(ctx context.Context, token, id string) ( func (lm *loggingMiddleware) ViewClientPerms(ctx context.Context, token, id string) (p []string, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -74,7 +74,7 @@ func (lm *loggingMiddleware) ViewClientPerms(ctx context.Context, token, id stri func (lm *loggingMiddleware) ListClients(ctx context.Context, token, reqUserID string, pm mgclients.Page) (cp mgclients.ClientsPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("user_id", reqUserID), slog.Group( @@ -96,7 +96,7 @@ func (lm *loggingMiddleware) ListClients(ctx context.Context, token, reqUserID s func (lm *loggingMiddleware) UpdateClient(ctx context.Context, token string, client mgclients.Client) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "client", @@ -117,7 +117,7 @@ func (lm *loggingMiddleware) UpdateClient(ctx context.Context, token string, cli func (lm *loggingMiddleware) UpdateClientTags(ctx context.Context, token string, client mgclients.Client) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "client", @@ -137,7 +137,7 @@ func (lm *loggingMiddleware) UpdateClientTags(ctx context.Context, token string, func (lm *loggingMiddleware) UpdateClientSecret(ctx context.Context, token, oldSecret, newSecret string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "things", @@ -156,7 +156,7 @@ func (lm *loggingMiddleware) UpdateClientSecret(ctx context.Context, token, oldS func (lm *loggingMiddleware) EnableClient(ctx context.Context, token, id string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -172,7 +172,7 @@ func (lm *loggingMiddleware) EnableClient(ctx context.Context, token, id string) func (lm *loggingMiddleware) DisableClient(ctx context.Context, token, id string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", id), } @@ -188,7 +188,7 @@ func (lm *loggingMiddleware) DisableClient(ctx context.Context, token, id string func (lm *loggingMiddleware) ListClientsByGroup(ctx context.Context, token, channelID string, cp mgclients.Page) (mp mgclients.MembersPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", channelID), slog.Group( @@ -210,7 +210,7 @@ func (lm *loggingMiddleware) ListClientsByGroup(ctx context.Context, token, chan func (lm *loggingMiddleware) Identify(ctx context.Context, key string) (id string, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "thing", @@ -229,7 +229,7 @@ func (lm *loggingMiddleware) Identify(ctx context.Context, key string) (id strin func (lm *loggingMiddleware) Authorize(ctx context.Context, req *magistrala.AuthorizeReq) (id string, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_key", req.GetSubject()), slog.String("channel_id", req.GetObject()), @@ -246,7 +246,7 @@ func (lm *loggingMiddleware) Authorize(ctx context.Context, req *magistrala.Auth func (lm *loggingMiddleware) Share(ctx context.Context, token, id, relation string, userids ...string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", id), slog.Any("user_ids", userids), @@ -264,7 +264,7 @@ func (lm *loggingMiddleware) Share(ctx context.Context, token, id, relation stri func (lm *loggingMiddleware) Unshare(ctx context.Context, token, id, relation string, userids ...string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", id), slog.Any("user_ids", userids), @@ -282,7 +282,7 @@ func (lm *loggingMiddleware) Unshare(ctx context.Context, token, id, relation st func (lm *loggingMiddleware) DeleteClient(ctx context.Context, token, id string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("thing_id", id), } diff --git a/twins/api/logging.go b/twins/api/logging.go index b7570df55..6867eda78 100644 --- a/twins/api/logging.go +++ b/twins/api/logging.go @@ -28,7 +28,7 @@ func LoggingMiddleware(svc twins.Service, logger *slog.Logger) twins.Service { func (lm *loggingMiddleware) AddTwin(ctx context.Context, token string, twin twins.Twin, def twins.Definition) (tw twins.Twin, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "twin", @@ -50,7 +50,7 @@ func (lm *loggingMiddleware) AddTwin(ctx context.Context, token string, twin twi func (lm *loggingMiddleware) UpdateTwin(ctx context.Context, token string, twin twins.Twin, def twins.Definition) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "twin", @@ -72,7 +72,7 @@ func (lm *loggingMiddleware) UpdateTwin(ctx context.Context, token string, twin func (lm *loggingMiddleware) ViewTwin(ctx context.Context, token, twinID string) (tw twins.Twin, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("twin_id", twinID), } @@ -89,7 +89,7 @@ func (lm *loggingMiddleware) ViewTwin(ctx context.Context, token, twinID string) func (lm *loggingMiddleware) ListTwins(ctx context.Context, token string, offset, limit uint64, name string, metadata twins.Metadata) (page twins.Page, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "page", @@ -111,7 +111,7 @@ func (lm *loggingMiddleware) ListTwins(ctx context.Context, token string, offset func (lm *loggingMiddleware) SaveStates(ctx context.Context, msg *messaging.Message) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "message", @@ -133,7 +133,7 @@ func (lm *loggingMiddleware) SaveStates(ctx context.Context, msg *messaging.Mess func (lm *loggingMiddleware) ListStates(ctx context.Context, token string, offset, limit uint64, twinID string) (page twins.StatesPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("twin_id", twinID), slog.Group( @@ -155,7 +155,7 @@ func (lm *loggingMiddleware) ListStates(ctx context.Context, token string, offse func (lm *loggingMiddleware) RemoveTwin(ctx context.Context, token, twinID string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("twin_id", twinID), } diff --git a/users/api/logging.go b/users/api/logging.go index 6fd9de637..b734f0279 100644 --- a/users/api/logging.go +++ b/users/api/logging.go @@ -30,7 +30,7 @@ func LoggingMiddleware(svc users.Service, logger *slog.Logger) users.Service { // If the request fails, it logs the error. func (lm *loggingMiddleware) RegisterClient(ctx context.Context, token string, client mgclients.Client) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("user", slog.String("id", c.ID), slog.String("name", c.Name)), } @@ -48,7 +48,7 @@ func (lm *loggingMiddleware) RegisterClient(ctx context.Context, token string, c // If the request fails, it logs the error. func (lm *loggingMiddleware) IssueToken(ctx context.Context, identity, secret, domainID string) (t *magistrala.Token, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("domain_id", domainID), } @@ -69,7 +69,7 @@ func (lm *loggingMiddleware) IssueToken(ctx context.Context, identity, secret, d // If the request fails, it logs the error. func (lm *loggingMiddleware) RefreshToken(ctx context.Context, refreshToken, domainID string) (t *magistrala.Token, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("domain_id", domainID), } @@ -90,7 +90,7 @@ func (lm *loggingMiddleware) RefreshToken(ctx context.Context, refreshToken, dom // If the request fails, it logs the error. func (lm *loggingMiddleware) ViewClient(ctx context.Context, token, id string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("user", slog.String("id", id), slog.String("name", c.Name)), } @@ -108,7 +108,7 @@ func (lm *loggingMiddleware) ViewClient(ctx context.Context, token, id string) ( // If the request fails, it logs the error. func (lm *loggingMiddleware) ViewProfile(ctx context.Context, token string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("user", slog.String("id", c.ID), slog.String("name", c.Name)), } @@ -126,7 +126,7 @@ func (lm *loggingMiddleware) ViewProfile(ctx context.Context, token string) (c m // If the request fails, it logs the error. func (lm *loggingMiddleware) ListClients(ctx context.Context, token string, pm mgclients.Page) (cp mgclients.ClientsPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group( "page", @@ -149,7 +149,7 @@ func (lm *loggingMiddleware) ListClients(ctx context.Context, token string, pm m // If the request fails, it logs the error. func (lm *loggingMiddleware) UpdateClient(ctx context.Context, token string, client mgclients.Client) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("user", slog.String("id", c.ID)), slog.String("name", c.Name), slog.Any("metadata", c.Metadata), } @@ -167,7 +167,7 @@ func (lm *loggingMiddleware) UpdateClient(ctx context.Context, token string, cli // If the request fails, it logs the error. func (lm *loggingMiddleware) UpdateClientTags(ctx context.Context, token string, client mgclients.Client) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("user", slog.String("id", c.ID), slog.Any("tags", fmt.Sprintf("%v", c.Tags))), } @@ -185,7 +185,7 @@ func (lm *loggingMiddleware) UpdateClientTags(ctx context.Context, token string, // If the request fails, it logs the error. func (lm *loggingMiddleware) UpdateClientIdentity(ctx context.Context, token, id, identity string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("user", slog.String("id", c.ID)), } @@ -203,7 +203,7 @@ func (lm *loggingMiddleware) UpdateClientIdentity(ctx context.Context, token, id // If the request fails, it logs the error. func (lm *loggingMiddleware) UpdateClientSecret(ctx context.Context, token, oldSecret, newSecret string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("user", slog.String("id", c.ID), slog.String("name", c.Name)), } @@ -221,7 +221,7 @@ func (lm *loggingMiddleware) UpdateClientSecret(ctx context.Context, token, oldS // If the request fails, it logs the error. func (lm *loggingMiddleware) GenerateResetToken(ctx context.Context, email, host string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("host", host), } @@ -239,7 +239,7 @@ func (lm *loggingMiddleware) GenerateResetToken(ctx context.Context, email, host // If the request fails, it logs the error. func (lm *loggingMiddleware) ResetSecret(ctx context.Context, token, secret string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), } if err != nil { @@ -256,7 +256,7 @@ func (lm *loggingMiddleware) ResetSecret(ctx context.Context, token, secret stri // If the request fails, it logs the error. func (lm *loggingMiddleware) SendPasswordReset(ctx context.Context, host, email, user, token string) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("host", host), } @@ -274,7 +274,7 @@ func (lm *loggingMiddleware) SendPasswordReset(ctx context.Context, host, email, // If the request fails, it logs the error. func (lm *loggingMiddleware) UpdateClientRole(ctx context.Context, token string, client mgclients.Client) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("user", slog.String("id", c.ID), slog.String("role", client.Role.String())), } @@ -292,7 +292,7 @@ func (lm *loggingMiddleware) UpdateClientRole(ctx context.Context, token string, // If the request fails, it logs the error. func (lm *loggingMiddleware) EnableClient(ctx context.Context, token, id string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", c.ID), } @@ -310,7 +310,7 @@ func (lm *loggingMiddleware) EnableClient(ctx context.Context, token, id string) // If the request fails, it logs the error. func (lm *loggingMiddleware) DisableClient(ctx context.Context, token, id string) (c mgclients.Client, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("id", c.ID), } @@ -328,7 +328,7 @@ func (lm *loggingMiddleware) DisableClient(ctx context.Context, token, id string // If the request fails, it logs the error. func (lm *loggingMiddleware) ListMembers(ctx context.Context, token, objectKind, objectID string, cp mgclients.Page) (mp mgclients.MembersPage, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group("object", slog.String("kind", objectKind), slog.String("id", objectID)), slog.Group( @@ -351,7 +351,7 @@ func (lm *loggingMiddleware) ListMembers(ctx context.Context, token, objectKind, // Identify logs the identify request. It logs the time it took to complete the request. func (lm *loggingMiddleware) Identify(ctx context.Context, token string) (id string, err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), } if err != nil { diff --git a/ws/api/logging.go b/ws/api/logging.go index 387798bff..7ecce696f 100644 --- a/ws/api/logging.go +++ b/ws/api/logging.go @@ -27,7 +27,7 @@ func LoggingMiddleware(svc ws.Service, logger *slog.Logger) ws.Service { // If the request fails, it logs the error. func (lm *loggingMiddleware) Subscribe(ctx context.Context, thingKey, chanID, subtopic string, c *ws.Client) (err error) { defer func(begin time.Time) { - args := []interface{}{ + args := []any{ slog.String("duration", time.Since(begin).String()), slog.String("channel_id", chanID), }