logging: remove ctx from global log methods (#5337)

* log: remove warn

* log: update debug

* log: update info

* remove level, log

* remove contextLogger function
This commit is contained in:
Caleb Doxsey 2024-10-23 14:18:52 -06:00 committed by GitHub
parent 1ccaf1b22b
commit d2c14cd6d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 150 additions and 198 deletions

View file

@ -135,7 +135,7 @@ func (mgr *Manager) refreshLoop(ctx context.Context, update <-chan updateRecords
mgr.onUpdateRecords(ctx, msg)
}
log.Debug(ctx).
log.Ctx(ctx).Debug().
Int("sessions", mgr.sessions.Len()).
Int("users", mgr.users.Len()).
Msg("initial sync complete")
@ -205,14 +205,14 @@ func (mgr *Manager) refreshLoop(ctx context.Context, update <-chan updateRecords
// user info refresh. If an access token refresh or a user info refresh fails
// with a permanent error, the session will be deleted.
func (mgr *Manager) refreshSession(ctx context.Context, userID, sessionID string) {
log.Info(ctx).
log.Ctx(ctx).Info().
Str("user_id", userID).
Str("session_id", sessionID).
Msg("refreshing session")
s, ok := mgr.sessions.Get(userID, sessionID)
if !ok {
log.Info(ctx).
log.Ctx(ctx).Info().
Str("user_id", userID).
Str("session_id", sessionID).
Msg("no session found for refresh")
@ -234,7 +234,7 @@ func (mgr *Manager) refreshSessionInternal(
) bool {
authenticator := mgr.cfg.Load().authenticator
if authenticator == nil {
log.Info(ctx).
log.Ctx(ctx).Info().
Str("user_id", userID).
Str("session_id", sessionID).
Msg("no authenticator defined, deleting session")
@ -244,7 +244,7 @@ func (mgr *Manager) refreshSessionInternal(
expiry := s.GetExpiresAt().AsTime()
if !expiry.After(mgr.now()) {
log.Info(ctx).
log.Ctx(ctx).Info().
Str("user_id", userID).
Str("session_id", sessionID).
Msg("deleting expired session")
@ -253,7 +253,7 @@ func (mgr *Manager) refreshSessionInternal(
}
if s.Session == nil || s.Session.OauthToken == nil {
log.Info(ctx).
log.Ctx(ctx).Info().
Str("user_id", userID).
Str("session_id", sessionID).
Msg("no session oauth2 token found for refresh")
@ -313,7 +313,7 @@ func (mgr *Manager) refreshSessionInternal(
}
func (mgr *Manager) refreshUser(ctx context.Context, userID string) {
log.Info(ctx).
log.Ctx(ctx).Info().
Str("user_id", userID).
Msg("refreshing user")
@ -324,7 +324,7 @@ func (mgr *Manager) refreshUser(ctx context.Context, userID string) {
u, ok := mgr.users.Get(userID)
if !ok {
log.Info(ctx).
log.Ctx(ctx).Info().
Str("user_id", userID).
Msg("no user found for refresh")
return
@ -334,7 +334,7 @@ func (mgr *Manager) refreshUser(ctx context.Context, userID string) {
for _, s := range mgr.sessions.GetSessionsForUser(userID) {
if s.Session == nil || s.Session.OauthToken == nil {
log.Info(ctx).
log.Ctx(ctx).Info().
Str("user_id", userID).
Msg("no session oauth2 token found for refresh")
continue