Feature #476

Error handler: Applications should be able to register an error handler

Added by Andreas Huggel almost 11 years ago. Updated over 6 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:design
Target version:0.21

Description

Allow applications to register a callback function which is used to process warnings and errors from the library.


Related issues

Related to Exiv2 - Feature #614: silence warnings from code Closed 29 Jan 2009

Associated revisions

Revision 2344
Added by Andreas Huggel over 6 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 over 6 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 over 6 years ago

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

Applications can provide their own log message handler now. See the new class Exiv2::LogMsg (error.hpp) for details

void newHandler(int lvl, const char* msg)
{
    printf("The message is: %s (level %d)\n", msg, lvl);
}

Exiv2::LogMsg::setHandler(newHandler);

#3 Updated by Andreas Huggel over 6 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux