-
Notifications
You must be signed in to change notification settings - Fork 562
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
Ability to print MuPDF errors to logging
instead of stdout
#3914
Comments
Latest PyMuPDF in git has new function The function docstring describes how to use it, but we'll also add it to the main documentation soon. |
Fixed in 1.24.12. See: https://pymupdf.readthedocs.io/en/latest/app3.html#diagnostics |
Okay thank you @julian-smith-artifex-com , I went from: # Work around https://github.com/pymupdf/PyMuPDF/issues/3914
pymupdf_logger = logging.getLogger(pymupdf.__name__)
def message(text="") -> None:
# https://github.com/pymupdf/PyMuPDF/blob/1.24.10/src/__init__.py#L102-L107,
# but with logging instead of print
# Warning was chosen since most `message` usages are errors or warnings
pymupdf_logger.warning(text)
pymupdf.message = message To this: pymupdf.set_messages(pylogging=True) |
Great, i'm glad it's working for you. |
Is your feature request related to a problem? Please describe.
PyMuPDF==1.24.10
will occasionally printMuPDF error
s tostdout
.The issue with
print
is:stdout
prints mess with CLI utilities likerich.Progress
barsDescribe the solution you'd like
Either:
logging.Logger
instead ofprint
message
to support a "level" argument (e.g. error level, debug level, etc)logging
Describe alternatives you've considered
None
Additional context
None
The text was updated successfully, but these errors were encountered: