Better logging for user activation and termination

This commit is contained in:
Andy Wang 2020-05-27 13:40:14 +01:00
parent aff53484eb
commit 5984fde09f

View File

@ -80,6 +80,9 @@ func (panel *userPanel) GetUser(UID []byte) (*ActiveUser, error) {
copy(user.arrUID[:], UID) copy(user.arrUID[:], UID)
panel.activeUsers[user.arrUID] = user panel.activeUsers[user.arrUID] = user
log.WithFields(log.Fields{
"UID": base64.StdEncoding.EncodeToString(UID),
}).Info("New active user")
return user, nil return user, nil
} }
@ -88,7 +91,7 @@ func (panel *userPanel) TerminateActiveUser(user *ActiveUser, reason string) {
log.WithFields(log.Fields{ log.WithFields(log.Fields{
"UID": base64.StdEncoding.EncodeToString(user.arrUID[:]), "UID": base64.StdEncoding.EncodeToString(user.arrUID[:]),
"reason": reason, "reason": reason,
}).Info("forcefully terminating user") }).Info("Terminating active user")
panel.updateUsageQueueForOne(user) panel.updateUsageQueueForOne(user)
user.closeAllSessions(reason) user.closeAllSessions(reason)
panel.activeUsersM.Lock() panel.activeUsersM.Lock()