From: <sl...@us...> - 2014-11-22 22:35:40
|
Revision: 5966 http://sourceforge.net/p/navit/code/5966 Author: sleske Date: 2014-11-22 22:35:38 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Fix:core:Use appropriate logging prio on Android, don't log everything as ERROR.|#1269, part 5 Modified Paths: -------------- trunk/navit/navit/debug.c Modified: trunk/navit/navit/debug.c =================================================================== --- trunk/navit/navit/debug.c 2014-11-22 22:35:22 UTC (rev 5965) +++ trunk/navit/navit/debug.c 2014-11-22 22:35:38 UTC (rev 5966) @@ -228,6 +228,26 @@ return "-invalid level-"; } +#ifdef HAVE_API_ANDROID +static android_LogPriority +dbg_level_to_android(dbg_level level) +{ + switch(level) { + case lvl_unset: + return ANDROID_LOG_UNKNOWN; + case lvl_error: + return ANDROID_LOG_ERROR; + case lvl_warning: + return ANDROID_LOG_WARN; + case lvl_info: + return ANDROID_LOG_INFO; + case lvl_debug: + return ANDROID_LOG_DEBUG; + } + return ANDROID_LOG_UNKNOWN; +} +#endif + void debug_vprintf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap) { @@ -236,7 +256,6 @@ #else char message_origin[mlen+flen+3]; #endif - FILE *fp=debug_fp; sprintf(message_origin, "%s:%s", module, function); if (global_debug_level >= level || debug_level_get(module) >= level || debug_level_get(message_origin) >= level) { @@ -262,7 +281,7 @@ MessageBoxW(NULL, muni, TEXT("Navit - Error"), MB_APPLMODAL|MB_OK|MB_ICONERROR); #else #ifdef HAVE_API_ANDROID - __android_log_print(ANDROID_LOG_ERROR,"navit", "%s", debug_message); + __android_log_print(dbg_level_to_android(level), "navit", "%s", debug_message); #else #ifdef HAVE_SOCKET if (debug_socket != -1) { @@ -270,6 +289,7 @@ return; } #endif + FILE *fp=debug_fp; if (! fp) fp = stderr; fprintf(fp,"%s",debug_message); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |