-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
tesseract: Disable Leptonica messages #543
Conversation
Disable debugging and informational messages from Leptonica for release builds. Signed-off-by: Stefan Weil <[email protected]>
stweil commented
DanBloomberg commented
|
I want the above option in the release build. |
Using the environment variable would imply that you always get at least one message from Leptonica because the code which enables / disables warnings also writes messages. :-( That's why I decided against that feature for the moment. |
cc: @DanBloomberg |
First, some more of the basics, for disabling at least all info and warning messages. You can define the external env variable to L_SEVERITY_ERROR. That will disable warnings, which I believe makes sense for tesseract. If you set this severity level at compile time, you guarantee that it can't be over-ridden at run-time. If you want to go further and suppress all messages, including those from the ERROR_* macros (which are different from the informational L_* macros), define NO_CONSOLE_IO on the compile line (or use L_SEVERITY_NONE). As for the suggestion that setMsgSeverity() tells you what it does, I can easily add a 2nd arg (debug) and only emit those messages when debug = TRUE. Stefan, is that what you want? |
Better, I'll just comment out the comments, leaving the interface unchanged. |
Yes, I'd prefer keeping the interface unchanged and disabling the messages (at least for arguments in the valid range). |
this change is pushed to leptonica master on github |
and modified to keep the warning(error) message but not the info(OK) messages |
An unset environment variable should not result in a warning, as this is the normal case. With the latest Leptonica code this requires unnecessarily tricky code. I'd use |
I was thinking that if you try to set it to the external value, and that value is not set, it should issue a warning because the attempt failed. I am already commenting the L_INFOs out there, and I can comment the warning out as well. |
All leptonica messages in setMsgSeverity() are now disabled, as requested. |
@@ -388,6 +388,11 @@ int main(int argc, char** argv) { | |||
static GenericVector<STRING> vars_vec; | |||
static GenericVector<STRING> vars_values; | |||
|
|||
#if !defined(DEBUG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to #ifdef NDEBUG
? NDEBUG
is more common than DEBUG
.
Either
If we want to separately control standard features and Tesseract features, we need both macros. Otherwise we could stick to using Personally I prefer keeping both macros, but I think that removing |
Disable debugging and informational messages from Leptonica
for release builds.
Signed-off-by: Stefan Weil [email protected]