mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
shorten file path in logs
Couldn't figure out how to do it at compile-time on Android.
This commit is contained in:
parent
2331cde2e7
commit
28318eb38a
3 changed files with 14 additions and 3 deletions
|
@ -979,7 +979,11 @@ void
|
|||
android_debugff(const char* func, const char* file, const char* fmt, ...)
|
||||
{
|
||||
char buf[256];
|
||||
snprintf( buf, sizeof(buf), "%s:%s(): %s", file, func, fmt );
|
||||
const char* shortPath = 1 + strrchr(file, '/');
|
||||
if ( !shortPath ) {
|
||||
shortPath = file;
|
||||
}
|
||||
snprintf( buf, sizeof(buf), "%s:%s(): %s", shortPath, func, fmt );
|
||||
|
||||
va_list ap;
|
||||
va_start( ap, fmt );
|
||||
|
|
|
@ -251,6 +251,8 @@ ifdef USE_SQLITE
|
|||
LIBS += -lsqlite3
|
||||
LIBS += -lmosquitto
|
||||
DEFINES += -DUSE_SQLITE
|
||||
DEFINES += -DSHORTFILE=\"$(notdir $<)\"
|
||||
|
||||
endif
|
||||
# Turn this off for now. I apparently have a memory problem, but it
|
||||
# doesn't make the app unusable for testing while crash on boot does.
|
||||
|
|
|
@ -77,12 +77,17 @@ extern void linux_debugf(const char*, ...)
|
|||
__attribute__ ((format (printf, 1, 2)));
|
||||
# define XP_DEBUGF(...) linux_debugf(__VA_ARGS__)
|
||||
|
||||
|
||||
#ifndef SHORTFILE
|
||||
# define SHORTFILE __FILE__
|
||||
#endif
|
||||
|
||||
extern void linux_debugff(const char* func, const char* file, int line, const char* fmt, ...)
|
||||
__attribute__ ((format (printf, 4, 5)));
|
||||
# define XP_LOGFF( FMT, ... ) \
|
||||
linux_debugff( __func__, __FILE__, __LINE__, FMT, ##__VA_ARGS__ )
|
||||
linux_debugff( __func__, SHORTFILE, __LINE__, FMT, ##__VA_ARGS__ )
|
||||
#define XP_LOG(STR) \
|
||||
linux_debugff( __func__, __FILE__, "%s", STR )
|
||||
linux_debugff( __func__, SHORTFILE, "%s", STR )
|
||||
|
||||
#else
|
||||
# define XP_DEBUGF(ch,...)
|
||||
|
|
Loading…
Reference in a new issue