Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set log level from env var #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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
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
@@ -75,6 +78,8 @@ func (s *server) authenticate(w http.ResponseWriter, r *http.Request) {
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