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

Log Levels do not get respected / Progress bar not disableable? #58

Open
KevinCCucumber opened this issue Oct 30, 2024 · 5 comments
Open

Comments

@KevinCCucumber
Copy link

I am using the library in a LABview environment and am using version 0.13.3

This is my extraction method:

def import_a2l_file(a2l_file: str):
    a2l_file_path = Path(a2l_file)
    a2l_db_file = a2l_file_path.with_suffix('.a2ldb')

    if a2l_db_file.exists():
        logger.warning(f"Overwriting existing file: {a2l_db_file}")
        a2l_db_file.unlink()

    db = DB(loglevel="CRITICAL")
    session = db.import_a2l(str(a2l_file_path)) 

Despite the log level, I see the following output:

[WARNING (pya2l.A2LParser)]  MATRIX_DIM is missing one or more required parameters:
        yDim
        zDim
[WARNING (pya2l.A2LParser)]  MATRIX_DIM is missing one or more required parameters:
        yDim
        zDim
[Info (pya2l.A2LParser)]     Elapsed Time: 0.182[s]
[Info (pya2l.A2LParser)]     Number of keywords: 34885
⠦ writing to DB... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸ 100% Elapsed: 0:00:05 Remaining: 0:00:01

I would expect to see absolutely no output. Also, the progressbar breaks Labview since

  1. Streaming is not supported
  2. Labview throws an error because of the braille signs used

Did I miss anything or is it a bug?

@christoph2
Copy link
Owner

The warning messages are from a C++ extension, there is currently no connection to Python logging -- I'll add a silent option, which then also supresses the progress bar.

@KevinCCucumber
Copy link
Author

Ah, I see. The "Critical" logging level was used as an example that something is wrong - if I had to choose what inputs to see and what not, I would rather see everything from the C++ lib.
The real showstopper for me is the progress bar, so I would prefer an additional option to just disable this one.

@KevinCCucumber
Copy link
Author

Afaik the setting of a flag would need to be respected in
a2lparser.py line 359 like so: self.progress_bar = Progress(*progress_columns, disable=is_silent)

@christoph2
Copy link
Owner

Yes, the progress bar is the easy part, but for the C++ extensions there's more work to do.
But I think this can be finished by tomorrow.

@christoph2
Copy link
Owner

OK, just finished.
"Silence mode" is now available with loglevel critical

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

No branches or pull requests

2 participants