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 refactoring #4891

Merged
merged 7 commits into from
Mar 2, 2023
Merged

Logging refactoring #4891

merged 7 commits into from
Mar 2, 2023

Conversation

Durman
Copy link
Collaborator

@Durman Durman commented Feb 28, 2023

Fixing problems:

  • Logging call was in some another module, not where actual logging was happening. It made such record attributes as modulename or lineno useless.
  • Root logger was configured what could conflict with using logging in other add-ons.

New features

  • Colored logging =)
    image

How to use logging now?

Inside nodes nothing has changed self.debug(message)

In other modules:

- from sverchok.utils.logging import debug
- debug(message)

# option 1
+ import logging
+ logger = logging.geLogger('sverchok')
+ logger.debug(message)

# option 2
+ from sverchok.utils.sv_logging import sv_logger
+ sv_logger.debug(message)

# option 3
+ from sverchok.utils.sv_logging import get_logger
+ logger = get_logger()
+ logger.debug(message)

For Sverchok extensions first option is especially useful since during reloading event sverchok can reload after an extension. It has sense to add its own sub logger logging.getLogger('sverchok.megapolis')

Preflight checklist

  • Code changes complete.
  • Manual testing done.

@portnov
Copy link
Collaborator

portnov commented Feb 28, 2023

Do we really need sv_ prefix in module name?

@Durman
Copy link
Collaborator Author

Durman commented Feb 28, 2023

I have a conflict with build-in logging module when I execute files in the utils folder.

improve finding relative path
during registration of extension Blender text can be None
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