oemof / tespy

Thermal Engineering Systems in Python (TESPy). This package provides a powerful simulation toolkit for thermal engineering plants such as power plants, district heating systems or heat pumps.
https://tespy.readthedocs.io
MIT License
256 stars 80 forks source link

Feature/new logger #390

Closed jowr closed 1 year ago

jowr commented 1 year ago

General

The proposed changes introduce a constant string id for the logger object that is retrieved from the logging module. This allows us to modify the logging functionality in a programmatic way and simplifies the work that has to be done in libraries and applications that consume the TESPy library.

New logging levels have been introduced to facilitate a structured progress reporting and result handling in the future. This is going to be covered in a separate PR since some more changes in the network solver would make it hard to review both changes simultaneously.

Shorthand functions have been added to the tespy.tools.logger file that mimic the behaviour of the original logging functions. All source code files using the logging facilities have been altered to use the new functions. The shorthand functions modify the stack handling in the logging library to make it trace past the wrapper functions in the tespy.tools.logger file. This particular remains to be tested, but it seems to work at a first glance.

Documentation

All new functions have local documentation attached. Please let me know, if more documentation is needed other places.

Testing

The existing tests use the logging functionality and it should thus be regarded as tested.

jowr commented 1 year ago

closes #390

fwitte commented 1 year ago

@jowr, thank you very much for the suggested modifications and additions. I really do like them. I have modified some small things locally and wanted to push them to your branch but I have no permissions to do so (On merge requests you can allow maintainers to push to the branch. I really guess you know that, so maybe it was intentional? ).

I am just going to push those commits to my dev and then merge your branch.

jowr commented 1 year ago

Thanks again and I am going to keep an eye on the flake8 formatting myself next time 😉