Skip to content

Conversation

@ryandawsonuk
Copy link

@ryandawsonuk ryandawsonuk commented Nov 26, 2019

to help debug #2

An example of debug logging for a new session:
image

Copy link
Contributor

@yanniszark yanniszark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ryandawsonuk!
Overall looks good, just a couple of nits.
After that and a rebase we should be good to go.

handlers.go Outdated
logger.Debug("Existing user session "+userID)
returnStatus(w, http.StatusOK, "OK")
return
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this else is not needed.
After this point, you know it's a new session anyway

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of the else is to log the session struct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is that at that point, you know that this is a new session, because we return inside the if.
Thus, the else is not necessary, you could just log it.

Copy link
Author

@ryandawsonuk ryandawsonuk Dec 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand now. Yes that's clearer to have it in the main flow rather than the else.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated now

handlers.go Outdated
logger.Errorf("Failed to save state in store: %v", err)
returnStatus(w, http.StatusInternalServerError, "Failed to save state in store.")
return
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, is else needed here?

Copy link
Author

@ryandawsonuk ryandawsonuk Dec 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also logs the session struct and means it can be seen what has changed in since the struct was created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants