Project

General

Profile

Feature #476

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

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

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
design
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

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 codeClosed29 Jan 2009

Actions

Associated revisions

Revision 2344 (diff)
Added by Andreas Huggel about 11 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 (diff)
Added by Andreas Huggel almost 11 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 11 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 almost 11 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF