Skip to content

Conversation

@jafranc
Copy link
Contributor

@jafranc jafranc commented Oct 2, 2025

This PR aims at revising the Logger and logging portability between VTK filters and their paraview plugins counterparts (in geos-pv). It plans to:

  • Limit code duplication : add a PoC on one filter to demo decorator keeping old behavior/arch
  • Extend under first round approval the decorator to all plugins
  • Explore new arch that can avoid the introduction of a switch

--- New arch---

Based on VTKHandler example,

  • provide a specific handler GEOSHandler to have access to emit logic and format
  • revamp the formatting into GEOSFomatter with a TrimColor funcion to help passing bash color tag free string to vtk inner logic
  • keep the initial getLogger but with propagate=True to stick to original logging class train of thoughts and allow file handler too. Might be replace by logging.getLogger soon, if proper refactor and encapsulation of logger init is done.

The addition does not need an "adding function" type of decorator, just to decorate the handler removal step in the PV plugin initializer. Then removal of previous details helpers in geos-utils and appening to Logger module

This will includes all PV plugins with exceptions:

  • PVGeosBlockExtractMerge.py , PVMohrCirclePlot.py for now as they have a more complex structure and did not directly fit this PR but can be treated in a forthcoming one
  • PVPythonViewConfigurator.py and PVGeosLogReader.py as they do not fit this refactor

@jafranc jafranc self-assigned this Oct 2, 2025
@jafranc
Copy link
Contributor Author

jafranc commented Oct 2, 2025

I added a suggested pre-commit hook script. I find it easier to check that all linter and formatters pass. That the doc compiled too.

If you think this deserves a PR on its own, I can adjust

Copy link
Contributor

@RomainBaville RomainBaville left a comment

Choose a reason for hiding this comment

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

You have done a great job, it seems easier to maintain and limite the code duplication.

@paloma-martinez
Copy link
Collaborator

Looks good to me !

Copy link
Contributor Author

@jafranc jafranc left a comment

Choose a reason for hiding this comment

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

Then I'll proceed changing other files 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants