On Thu, Sep 8, 2011 at 11:37 AM, Jim Pendleton <[email protected]> wrote: > Frank Warmerdam <warmerdam <at> pobox.com> writes: > >> On 11-09-08 07:48 AM, Jim Pendleton wrote: >> > Is there any model for redirecting CPLDebug output from stdout to an >> > alternative path? >> >> There is no need to overwrite the high level CPLError and CPLDebug > functions. >> Instead install a handler for the messages with CPLSetErrorHandler(). > > That was the information I needed. > > For the sake of expediency, I've ifdef'ed __android_log_print() calls > adjacent to the printf() statements in the existing > CPLDefaultErrorHandler rather than duplicating the code and adding > another source file to the build.
Jim, In fact this might even be the long term solution with an android #ifdef. > If I eventually proceed the approved GDAL development way is there a > standard place to call CPLSetErrorHandler() when loading GDAL as a > library? Since I'm running in Java, I wouldn't necessarily have a > pointer to my C++ function at runtime without some extra hackery (and > there's no SWIG binding presently for that routine, regardless.) Ah yes, that does make it more complicated. I'm not sure of a good way to have something done automatically at library load time. I see the gdal_python.i file has an init section for registering drivers. Something similar might possible in Java. > I would like to perturb as little of the original GDAL source as > possible. > > If only there existed a gdal.SetConfigOption interface for > CPLSetErrorHandler() that would allow me to pass an entry point name > instead of a function pointer... I see that CPLPushErrorHandler() already does this through the swig bindings for "well known" error handlers. I think for now an android ifdef right in CPLDefaultErrorHandler is appropriate. Best regards, -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, [email protected] light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Software Developer _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
