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

SimConnect class produces unwanted verbose output #10

Open
lucasangarola opened this issue Jul 30, 2023 · 2 comments
Open

SimConnect class produces unwanted verbose output #10

lucasangarola opened this issue Jul 30, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@lucasangarola
Copy link

During the process of integrating this great implementation on my simulation software I realized that the SC class will log directly to logging.
For those that would like to import the module and use it as-is (my case), it would be great that the exceptions are propagated without logging involved. In this way I would be able to handle and print what is necessary on my software.
At the moment, when the Sim is not running, the class will spam my software logging console with unwanted messages.

Suggestion:
I would suggest to add a verbose flag as part of the class init, which will enable any logging information. You can make it True by default, but at least I get some control :)

class SimConnect:
    def __init__(
            self,
            name='pySimConnect',
            dll_path=_dll_path,
            default_receivers=_default_receivers,
            poll_interval_seconds=0.05,
            verbose: bool = True):

Thank you very much in advance!

@patricksurry patricksurry added the enhancement New feature or request label Aug 1, 2023
@patricksurry
Copy link
Owner

Thanks for the feedback.

You're right it'd be better if it configured a named logger (see https://stackoverflow.com/questions/35325042/python-logging-disable-logging-from-imported-modules) and used a less verbose default. I'll take a look at that.

In the short term, you should be able to change the default log level by setting an environment variable (see https://github.com/patricksurry/pysimconnect/blob/master/simconnect/sc.py#L21).

e.g. on *nix platforms try export LOGLEVEL=WARNING and you should get less noise.

@lucasangarola
Copy link
Author

Thank you for your answer!
I would rather wait for the proper fix. I use logger across my application, hence I don't want to modify the logging level.
Looking forward to your fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants