Is there any model for redirecting CPLDebug output from stdout to an alternative path?
Since I have no command line or stdout in my Android activity where I call GDAL as a library, "|" and ">" are not available. I'd like the option to send the output of CPLDebug to Android's LogCat or even to an output file, if required. I confess to being a C++ lightweight, in addition to having a lack of expertise in GDAL, so port/cpl_port.h's syntax for CPL_PRINT_FUNC_FORMAT at the root of the definition of CPLDebug has me flummoxed: #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx))) The __android_log_print() function for sending output to the LogCat stream is similar to printf(), but with two extra initial arguments that I could in theory hardwire for my own purposes in an ifdef so existing calls to CPL_DEBUG throughout GDAL would not need to be modified. Conceptually, but not syntactically, in cpl_port.h I would like an overriding definition something like this: #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP) #ifdef ANDROID #include <android/log.h> #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__android_log_print, ANDROID_LOG_DEBUG, "GDAL", format_idx, arg_idx))) #else #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx))) ... As always, thanks for any assistance. Jim P.
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
