3rd-party-integrations/github-team-sync

Improve Logging on errors

Chocrates opened this issue · 2 comments

In some places we log exceptions and continue forward, here for example https://github.com/github/github-team-sync/blob/5d50752e9f1b812a9ddfe9f97ee666d3c3f349ac/githubapp/ldap.py#L87

Some of the errors printed currently are not that useful "mail" for instance when the actual exception is a missing attribute on the object,

We should clean this up.

Hi @Chocrates, I'm Rishabh, Can you please elaborate this issue?

Thanks @anonymousr007, in many places we log the exception directly. The message that the exception throws are things like "mail" or other tersely worded errors.
See https://github.com/github/github-team-sync/blob/a18ca46a12b251c27e0582f769e073e0a0d24fad/githubapp/ldap.py#L87

It looks like this was mostly fixed in the latest code to print stack traces https://github.com/github/github-team-sync/blob/main/app.py#L94

If you'd like you can use this one to focus on rewriting all the logging to use a unified pattern, possibly using logging see https://github.com/github/github-team-sync/blob/main/githubapp/okta.py#L7

I don't have a strong opinion on how logging gets done though, as long as we get stack traces for exceptions :)

cc: @primetheus