@@ -4491,10 +4491,34 @@ SWIGINTERN PyObject *_wrap_LogMsg_handler(PyObject *self, PyObject *args) {
44914491}
44924492
44934493
4494+ SWIGINTERN int Swig_var_LogMsg_defaultHandler_set (PyObject *) {
4495+ SWIG_Error (SWIG_AttributeError," Variable LogMsg_defaultHandler is read-only." );
4496+ return 1 ;
4497+ }
4498+
4499+
4500+ SWIGINTERN PyObject *Swig_var_LogMsg_defaultHandler_get (void ) {
4501+ PyObject *pyobj = 0 ;
4502+ PyObject *self = 0 ;
4503+
4504+ (void )self;
4505+ pyobj = SWIG_NewFunctionPtrObj ((void *)(Exiv2::LogMsg::defaultHandler), SWIGTYPE_p_f_int_p_q_const__char__void);
4506+ return pyobj;
4507+ }
4508+
4509+
4510+ SWIGINTERN PyObject *_wrap_LogMsg_defaultHandler_get (PyObject *SWIGUNUSEDPARM (self), PyObject *SWIGUNUSEDPARM(args)) {
4511+ return Swig_var_LogMsg_defaultHandler_get ();
4512+ }
4513+
4514+
44944515static PyMethodDef SwigMethods[] = {
4516+ { " LogMsg_defaultHandler_get" , _wrap_LogMsg_defaultHandler_get, METH_VARARGS, NULL },
44954517 { NULL , NULL , 0 , NULL }
44964518};
44974519
4520+ static SwigPyGetSet LogMsg_defaultHandler_getset = { _wrap_LogMsg_defaultHandler_get, 0 };
4521+ static PyGetSetDef LogMsg_defaultHandler_getset_def = { (char *)" defaultHandler" , SwigPyBuiltin_FunpackGetterClosure, 0 , (char *)" Exiv2::LogMsg.defaultHandler" , &LogMsg_defaultHandler_getset };
44984522static SwigPyGetSet LogMsg___dict___getset = { SwigPyObject_get___dict__, 0 };
44994523SWIGINTERN PyGetSetDef SwigPyBuiltin__Exiv2__LogMsg_getset[] = {
45004524 { (char *)" __dict__" , SwigPyBuiltin_FunpackGetterClosure, 0 , (char *)" \n "
@@ -4578,31 +4602,18 @@ static PyHeapTypeObject SwigPyBuiltin__Exiv2__LogMsg_type = {
45784602 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_CHECKTYPES, /* tp_flags */
45794603#endif
45804604 " \n "
4581- " Class for a log message, used by the library. Applications can set\n "
4582- " the log level and provide a customer log message handler (callback\n "
4583- " function).\n "
4584- " \n "
4585- " This class is meant to be used as a temporary object with the\n "
4586- " related macro-magic like this:\n "
4605+ " Static class to control logging.\n "
45874606 " \n "
4588- " ``\n "
4589- " EXV_WARNING << \" Warning! Something looks fishy.\\ n\" ;\n "
4590- " ``\n "
4607+ " Applications can set the log level and change the log message handler.\n "
45914608 " \n "
4592- " which translates to\n "
4609+ " The default handler :attr:`pythonHandler` sends messages to Python's\n "
4610+ " :mod:`logging` system. Exiv2's handler :attr:`defaultHandler` sends\n "
4611+ " messages to standard error. To change handler pass\n "
4612+ " :attr:`exiv2.pythonHandler<pythonHandler>` or\n "
4613+ " :attr:`exiv2.LogMsg.defaultHandler<defaultHandler>` to\n "
4614+ " :meth:`setHandler`.\n "
45934615 " \n "
4594- " ``\n "
4595- " if (LogMsg::warn >= LogMsg::level() && LogMsg::handler())\n "
4596- " LogMsg(LogMsg::warn).os() << \" Warning! Something looks fishy.\\ n\" ;\n "
4597- " ``\n "
4598- " \n "
4599- " The macros EXV_DEBUG, EXV_INFO, EXV_WARNING and EXV_ERROR are\n "
4600- " shorthands and ensure efficient use of the logging facility: If a\n "
4601- " log message doesn't need to be generated because of the log level\n "
4602- " setting, the temp object is not even created.\n "
4603- " \n "
4604- " Caveat: The entire log message is not processed in this case. So don't\n "
4605- " make that call any logic that always needs to be executed.\n "
4616+ " To disable logging entirely pass :obj:`None` to :meth:`setHandler`.\n "
46064617 " " , /* tp_doc */
46074618 (traverseproc) 0 , /* tp_traverse */
46084619 (inquiry) 0 , /* tp_clear */
@@ -4809,31 +4820,18 @@ static PyTypeObject *SwigPyBuiltin__Exiv2__LogMsg_type_create(PyTypeObject *type
48094820 { Py_tp_is_gc, (void *)(inquiry) 0 },
48104821 { Py_tp_del, (void *)(destructor) 0 },
48114822 { Py_tp_doc, (void *)" \n "
4812- " Class for a log message, used by the library. Applications can set\n "
4813- " the log level and provide a customer log message handler (callback\n "
4814- " function).\n "
4815- " \n "
4816- " This class is meant to be used as a temporary object with the\n "
4817- " related macro-magic like this:\n "
4823+ " Static class to control logging.\n "
48184824 " \n "
4819- " ``\n "
4820- " EXV_WARNING << \" Warning! Something looks fishy.\\ n\" ;\n "
4821- " ``\n "
4825+ " Applications can set the log level and change the log message handler.\n "
48224826 " \n "
4823- " which translates to\n "
4827+ " The default handler :attr:`pythonHandler` sends messages to Python's\n "
4828+ " :mod:`logging` system. Exiv2's handler :attr:`defaultHandler` sends\n "
4829+ " messages to standard error. To change handler pass\n "
4830+ " :attr:`exiv2.pythonHandler<pythonHandler>` or\n "
4831+ " :attr:`exiv2.LogMsg.defaultHandler<defaultHandler>` to\n "
4832+ " :meth:`setHandler`.\n "
48244833 " \n "
4825- " ``\n "
4826- " if (LogMsg::warn >= LogMsg::level() && LogMsg::handler())\n "
4827- " LogMsg(LogMsg::warn).os() << \" Warning! Something looks fishy.\\ n\" ;\n "
4828- " ``\n "
4829- " \n "
4830- " The macros EXV_DEBUG, EXV_INFO, EXV_WARNING and EXV_ERROR are\n "
4831- " shorthands and ensure efficient use of the logging facility: If a\n "
4832- " log message doesn't need to be generated because of the log level\n "
4833- " setting, the temp object is not even created.\n "
4834- " \n "
4835- " Caveat: The entire log message is not processed in this case. So don't\n "
4836- " make that call any logic that always needs to be executed.\n "
4834+ " To disable logging entirely pass :obj:`None` to :meth:`setHandler`.\n "
48374835 " " },
48384836 { Py_tp_repr, (void *)(reprfunc) 0 },
48394837 { Py_tp_str, (void *)(reprfunc) 0 },
@@ -4957,6 +4955,7 @@ static swig_cast_info *swig_cast_initial[] = {
49574955/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
49584956
49594957static swig_const_info swig_const_table[] = {
4958+ { SWIG_PY_POINTER, " pythonHandler" , 0 , 0 , (void *)(&log_to_python), &SWIGTYPE_p_f_int_p_q_const__char__void },
49604959{0 , 0 , 0 , 0.0 , 0 , 0 }};
49614960
49624961#ifdef __cplusplus
@@ -5419,7 +5418,7 @@ SWIG_init(void) {
54195418
54205419 SWIG_InstallConstants (d,swig_const_table);
54215420
5422- SWIG_Python_SetConstant (d, d == md ? public_interface : NULL , " __doc__" ,SWIG_FromCharPtr (" Exiv2 error codes and log messages ." ));
5421+ SWIG_Python_SetConstant (d, d == md ? public_interface : NULL , " __doc__" ,SWIG_FromCharPtr (" Exiv2 error codes and message logging ." ));
54235422
54245423 if (strcmp (SWIG_name," _error" )) {
54255424 Python_Exiv2_ErrorCode = import_from_python (" exiv2." " _error" ," ErrorCode" );
@@ -5436,6 +5435,7 @@ SWIG_init(void) {
54365435 Exiv2::LogMsg::setHandler (&log_to_python);
54375436
54385437
5438+
54395439 Python_Exiv2_extras_create_enum = import_from_python (" exiv2.extras" ," _create_enum" );
54405440 if (!Python_Exiv2_extras_create_enum)
54415441 return INIT_ERROR_RETURN;
@@ -5465,16 +5465,25 @@ SWIG_init(void) {
54655465 if (!Python_enum_IntEnum)
54665466 return INIT_ERROR_RETURN;
54675467
5468- SWIG_Python_SetConstant (d, d == md ? public_interface : NULL , " pythonHandler" ,SWIG_NewFunctionPtrObj (
5469- (void *)log_to_python, SWIGTYPE_p_f_int_p_q_const__char__void));
5470- SWIG_Python_SetConstant (d, d == md ? public_interface : NULL , " defaultHandler" ,SWIG_NewFunctionPtrObj (
5471- (void *)Exiv2::LogMsg::defaultHandler,
5472- SWIGTYPE_p_f_int_p_q_const__char__void));
5468+ globals = SWIG_globals ();
5469+ if (!globals) {
5470+ PyErr_SetString (PyExc_TypeError, " Failure to create SWIG globals." );
5471+ #if PY_VERSION_HEX >= 0x03000000
5472+ return NULL ;
5473+ #else
5474+ return ;
5475+ #endif
5476+ }
5477+ PyDict_SetItemString (md, " cvar" , globals);
5478+ SwigPyBuiltin_AddPublicSymbol (public_interface, " cvar" );
54735479 SWIG_Python_SetConstant (d, d == md ? public_interface : NULL , " Level" ,Python_Exiv2_LogMsg_Level);
54745480 builtin_base_count = 0 ;
54755481 builtin_bases[builtin_base_count] = NULL ;
54765482 PyDict_SetItemString (d, " this" , this_descr);
54775483 PyDict_SetItemString (d, " thisown" , thisown_descr);
5484+ static_getset = SwigPyStaticVar_new_getset (metatype, &LogMsg_defaultHandler_getset_def);
5485+ PyDict_SetItemString (d, static_getset->d_getset ->name , (PyObject *)static_getset);
5486+ SWIG_Py_DECREF ((PyObject *)static_getset);
54785487 builtin_pytype = SwigPyBuiltin__Exiv2__LogMsg_type_create (metatype, builtin_bases, d);
54795488 if (!builtin_pytype) {
54805489#if PY_VERSION_HEX >= 0x03000000
@@ -5488,6 +5497,7 @@ SWIG_init(void) {
54885497 PyModule_AddObject (m, " LogMsg" , (PyObject *)builtin_pytype);
54895498 SwigPyBuiltin_AddPublicSymbol (public_interface, " LogMsg" );
54905499 d = md;
5500+ SWIG_addvarlink (globals, " LogMsg_defaultHandler" , Swig_var_LogMsg_defaultHandler_get, Swig_var_LogMsg_defaultHandler_set);
54915501#if PY_VERSION_HEX >= 0x03000000
54925502 return m;
54935503#else
0 commit comments