ashutoshvarma / pyxpdf

Fast and memory-efficient Python PDF Parser based on xpdf sources
https://pyxpdf.readthedocs.io/
Other
40 stars 16 forks source link

add proper thread safe logging mechanism #14

Open ashutoshvarma opened 4 years ago

ashutoshvarma commented 4 years ago

As of now xpdf errors/warnings/logs are sent to stdout and only way to partially control it is with Config.error_quiet. Also pyxpdf in most cases cannot detect errors in xpdf sources as there is no error callback or logging mechanism implemented.

Ideas:- libxpdf has an error callback which can be utilized for log/error reporting.

# https://github.com/ashutoshvarma/libxpdf/blob/bc061b4e3da53b08a74e81706c6d8721af6b6094/xpdf-4.02/xpdf/Error.h#L39
extern void setErrorCallback(void (*cbk)(void *data, ErrorCategory category,

Also take a look at lxml's logging mechanism, their use case is also similar to us https://github.com/lxml/lxml/blob/master/src/lxml/xmlerror.pxi