Merge pull request #3349 from stweil/master

Disable most Leptonica messages for tesseract by default
This commit is contained in:
Egor Pugin 2021-03-20 22:47:11 +03:00 committed by GitHub
commit c7653bf59f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@
#if defined(__USE_GNU)
# include <cfenv> // for feenableexcept
#endif
#include <cstdlib> // for std::getenv
#include <iostream>
#include <allheaders.h>
@ -619,10 +620,13 @@ int main(int argc, char **argv) {
std::vector<std::string> vars_vec;
std::vector<std::string> vars_values;
#if defined(NDEBUG)
// Disable debugging and informational messages from Leptonica.
setMsgSeverity(L_SEVERITY_ERROR);
#endif
if (std::getenv("LEPT_MSG_SEVERITY")) {
// Get Leptonica message level from environment variable.
setMsgSeverity(L_SEVERITY_EXTERNAL);
} else {
// Disable debugging and informational messages from Leptonica.
setMsgSeverity(L_SEVERITY_ERROR);
}
#if defined(HAVE_TIFFIO_H) && defined(_WIN32)
/* Show libtiff errors and warnings on console (not in GUI). */