Feature #614

silence warnings from code

Added by drhex - almost 9 years ago. Updated about 7 years ago.

Status:ClosedStart date:29 Jan 2009
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:design
Target version:0.21

Description

When exiv2 is scanning the metadata of images, it often outputs warnings about minor problems on the console that makes it difficult to find messages about more acute problems. I know that one can run ./configure with -DSUPPRESS_WARNINGS to get it more quiet, but I reckon many users will have "apt-get installed" exiv2 rather than compiling it for themselves.
How about changing all the lines that now does e.g.
std:cerr << "Blah blah";
so that they instead call some central message-output method and also supply a severity level with the message.
Then, the code that calls exiv2 methods could call some method to set a threshold for which messages are passed thru to cerr.


Related issues

Related to Exiv2 - Feature #476: Error handler: Applications should be able to register an... Closed
Duplicated by Exiv2 - Bug #725: -DSUPPRESS_WARNINGS is kind of hokey Closed 02 Sep 2010

Associated revisions

Revision 2344
Added by Andreas Huggel about 7 years ago

#476, #614: Introduced class LogMsg for enhanced logging, migrated all existing warnings and error messages (not the exceptions) to use the new logic. Every log message now has a type (debug, info, warning, error). Applications can set a logging level to determine which messages are processed and supply a custom log message handler at runtime. (Based on a contribution by Simson Garfinkel.)

Revision 2415
Added by Andreas Huggel almost 7 years ago

#476, #614: Simplified LogMsg. It's not quite as elegant as before anymore but should be much more portable and more efficient. (MSVC 7.1 didn't like the original implementation.)

History

#2 Updated by Andreas Huggel about 7 years ago

  • Category changed from basicio to design
  • Status changed from New to Resolved
  • Target version set to 0.21
  • % Done changed from 0 to 100

Applications can now set the log level to determine which log messages they are interested in:

// Set the log level to only show errors (and suppress warnings, informational and debug messages)
Exiv2::LogMsg::setLevel(Exiv2::LogMsg::error);

To suppress all log messages set the log level to Exiv2::LogMsg::mute or set the log message handler to 0 (see #476).
For more details, see the new class Exiv2::LogMsg (error.hpp)

The SUPPRESS_WARNINGS mechanism still exists, in case there is a need to avoid compiling the log messaging calls in the library completely.

#3 Updated by Andreas Huggel about 7 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux