Skip to content

Commit e99d1f1

Browse files
committed
Remove excessive logging
1 parent 629b1a4 commit e99d1f1

8 files changed

+1
-18
lines changed

api/pkg/middlewares/api_key_auth_middleware.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func APIKeyAuth(logger telemetry.Logger, tracer telemetry.Tracer, userRepository
3333
}
3434

3535
c.Locals(ContextKeyAuthUserID, authUser)
36-
ctxLogger.Info(fmt.Sprintf("[%T] set successfully for user with ID [%s]", authUser, authUser.ID))
3736
return c.Next()
3837
}
3938
}

api/pkg/middlewares/bearer_api_key_auth_middleware.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ func BearerAPIKeyAuth(logger telemetry.Logger, tracer telemetry.Tracer, userRepo
1515
logger = logger.WithService("middlewares.APIKeyAuth")
1616

1717
return func(c *fiber.Ctx) error {
18-
ctx, span := tracer.StartFromFiberCtx(c, "middlewares.APIKeyAuth")
18+
ctx, span, _ := tracer.StartFromFiberCtxWithLogger(c, logger, "middlewares.APIKeyAuth")
1919
defer span.End()
2020

21-
ctxLogger := tracer.CtxLogger(logger, span)
22-
2321
apiKey := strings.TrimSpace(strings.Replace(c.Get(authHeaderBearer), bearerScheme, "", 1))
2422
if len(apiKey) == 0 {
2523
span.AddEvent(fmt.Sprintf("the request header has no [%s] api key", authHeaderAPIKey))
@@ -33,9 +31,6 @@ func BearerAPIKeyAuth(logger telemetry.Logger, tracer telemetry.Tracer, userRepo
3331
}
3432

3533
c.Locals(ContextKeyAuthUserID, authUser)
36-
37-
ctxLogger.Info(fmt.Sprintf("[%T] set successfully for user with ID [%s]", authUser, authUser.ID))
38-
3934
return c.Next()
4035
}
4136
}

api/pkg/middlewares/bearer_auth_middleware.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ func BearerAuth(logger telemetry.Logger, tracer telemetry.Tracer, authClient *au
4646
}
4747

4848
c.Locals(ContextKeyAuthUserID, authUser)
49-
50-
ctxLogger.Info(fmt.Sprintf("[%T] set successfully for user with ID [%s]", authUser, authUser.ID))
5149
return c.Next()
5250
}
5351
}

api/pkg/middlewares/http_request_logger_middleware.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ func HTTPRequestLogger(tracer telemetry.Tracer, logger telemetry.Logger) fiber.H
1818
_, span, ctxLogger := tracer.StartFromFiberCtxWithLogger(c, logger)
1919
defer span.End()
2020

21-
ctxLogger.WithString("http.method", c.Method()).
22-
WithString("http.path", c.Path()).
23-
WithString("client.version", c.Get(clientVersionHeader)).
24-
Trace(fmt.Sprintf("%s %s", c.Method(), c.OriginalURL()))
25-
2621
response := c.Next()
2722

2823
statusCode := c.Response().StatusCode()

api/pkg/middlewares/phone_api_key_auth_middleware.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func PhoneAPIKeyAuth(logger telemetry.Logger, tracer telemetry.Tracer, repositor
3131
}
3232

3333
c.Locals(ContextKeyAuthUserID, authUser)
34-
ctxLogger.Info(fmt.Sprintf("[%T] set successfully for user with ID [%s]", authUser, authUser.ID))
3534
return c.Next()
3635
}
3736
}

api/pkg/repositories/gorm_phone_api_key_repository.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ func (repository *gormPhoneAPIKeyRepository) LoadAuthContext(ctx context.Context
9898
defer span.End()
9999

100100
if authContext, found := repository.cache.Get(apiKey); found {
101-
ctxLogger.Info(fmt.Sprintf("cache hit for user with ID [%s] and phone API Key ID [%s]", authContext.ID, *authContext.PhoneAPIKeyID))
102101
return authContext, nil
103102
}
104103

api/pkg/repositories/gorm_phone_repository.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ func (repository *gormPhoneRepository) Load(ctx context.Context, userID entities
123123
defer span.End()
124124

125125
if phone, found := repository.cache.Get(repository.getCacheKey(userID, phoneNumber)); found {
126-
ctxLogger.Info(fmt.Sprintf("cache hit for [%T] with ID [%s]", phone, userID))
127126
return phone, nil
128127
}
129128

api/pkg/repositories/gorm_user_repository.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ func (repository *gormUserRepository) LoadAuthContext(ctx context.Context, apiKe
154154
defer span.End()
155155

156156
if authUser, found := repository.cache.Get(apiKey); found {
157-
ctxLogger.Info(fmt.Sprintf("cache hit for user with ID [%s]", authUser.ID))
158157
return authUser, nil
159158
}
160159

0 commit comments

Comments
 (0)