BallAerospace / python-ballcosmos

Python Support for Ball Aerospace COSMOS v4
Other
18 stars 4 forks source link

ballcosmos destroys logging configuration #27

Open keck-in-space opened 1 year ago

keck-in-space commented 1 year ago

if ballcosmos is imported it overwrites my existing logging configuration

keck-in-space commented 1 year ago

https://github.com/BallAerospace/python-ballcosmos/blob/86ec6d27cd6b3ea338473c1a3980129f1a7d058e/ballcosmos/__init__.py#L21-L24

If I comment out these lines I don't get the logging behavior overwrite

AbdelAzizMohamedMousa commented 1 year ago

The logging.basicConfig() function is used to configure the logging system in Python. It should be called only once at the beginning of the program to set up the logging configuration.

By calling logging.basicConfig() more than once, the configuration of the logging system will be reset to its default settings, and any previous logging configuration will be lost.

In the code you provided, calling ballcosmos() after logging.basicConfig() will reset the logging configuration to its default settings and destroy any previous logging handlers, which may cause unexpected behavior in the logging system.

If you need to use ballcosmos() after configuring the logging system, you should ensure that it does not reset the logging configuration, or you should reconfigure the logging system after calling ballcosmos().

keck-in-space commented 1 year ago

I understand that, but a Python library should not be setting the logging configuration.