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

Logging Overhaul #947

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from
Draft

Logging Overhaul #947

wants to merge 15 commits into from

Conversation

amrsoll
Copy link
Contributor

@amrsoll amrsoll commented Aug 18, 2020

The MrbLogger doesn't use a Logger anymore, because it is one. A lot has been delegated to the logging utilities themselves.

I do like the force_kwargs function I wrote if I do say so myself :P It allows to get rid of the hacky kwargs['some_key'] = kwargs.get('some_key', default_value) and averything is in the function definition instead, making it easier for the IDE and linters alike.

Anyway, this also allows us to use logging.getLogger or mrb_logger.getLogger interchangeably - they are essentially the same thing. The default Logger class has been set to MrbLogger as soon as the plugin is loaded in, and the MrbLogger is compatible with the standard use of Loggers

@ghost
Copy link

ghost commented Aug 18, 2020

DeepCode's analysis on #ef115d found:

  • ℹ️ 1 minor issue. 👇

Top issues

Description Example fixes
No need to call keys, directly check with the in operator. Occurrences: 🔧 Example fixes

👉 View analysis in DeepCode’s Dashboard | Configure the bot


# Disable the exception stacktrace AXEL : but why?
@force_kwargs(analytics=True, exc_info=False,)
def exception(self, msg, analytics=True, exc_info=False, *args, **kwargs):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept that because of the original behaviour, but is it necessary?

date = self._getDateString()
id = kwargs.pop('id', self.id_short)
date = MrbLogger._getDateString()
id = id or self.name_short # FIXME id is reserved
Copy link
Contributor Author

Choose a reason for hiding this comment

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

id should really be refactored to something else

else:
self.logger.error('Could not write exception to analytics, the analytics handler was not initialized.')
self.error('Could not write exception to analytics, the analytics handler was not initialized.', analytics=False)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

prevents loops in case the analytics failed to load

@amrsoll
Copy link
Contributor Author

amrsoll commented Aug 18, 2020

I would like to merge this AFTER the Beta release, so I'm keeping it as a draft for now

@amrsoll
Copy link
Contributor Author

amrsoll commented Aug 25, 2020

Latest update : Need to ask Gina about the plugin initialisation, and if the dirty MrBeamLogger is used everywhere.

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.

1 participant