-
Notifications
You must be signed in to change notification settings - Fork 66
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
5b5c7c3
to
b2abdda
Compare
to help debug #2
An example of debug logging for a new session: