mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Restore suppression of informational log messages from PoDoFo
This commit is contained in:
parent
bea63dc6c4
commit
39d27b6245
@ -7,11 +7,20 @@
|
||||
using namespace PoDoFo;
|
||||
|
||||
#include "global.h"
|
||||
#include <iostream>
|
||||
|
||||
PyObject *pdf::Error = NULL;
|
||||
|
||||
static char podofo_doc[] = "Wrapper for the PoDoFo PDF library";
|
||||
|
||||
static void
|
||||
pdf_log_message(PdfLogSeverity logSeverity, const std::string_view& msg) {
|
||||
if (logSeverity == PdfLogSeverity::Error || logSeverity == PdfLogSeverity::Warning) {
|
||||
const char *level = logSeverity == PdfLogSeverity::Error ? "ERROR" : "WARNING";
|
||||
std::cerr << "PoDoFo" << level << ": " << msg << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
exec_module(PyObject *m) {
|
||||
if (PyType_Ready(&pdf::PDFDocType) < 0) return -1;
|
||||
@ -23,6 +32,8 @@ exec_module(PyObject *m) {
|
||||
|
||||
Py_INCREF(&pdf::PDFDocType);
|
||||
PyModule_AddObject(m, "PDFDoc", (PyObject *)&pdf::PDFDocType);
|
||||
|
||||
PdfCommon::SetLogMessageCallback(pdf_log_message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user