summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlogging.cpp
diff options
context:
space:
mode:
authorŁukasz Korbel <lkorbel@tuta.io>2022-04-04 21:02:38 +0700
committerŁukasz Korbel <lkorbel@tuta.io>2022-04-21 15:43:25 +0700
commitf10d0c781e6f605684de32d58dbffbd05a4b99a5 (patch)
tree50b6882c8bb2cea7f44f3e0447db2bef20318d8c /src/corelib/global/qlogging.cpp
parente47c22480fe84c100019cd92d0296f0dd2a7f3f1 (diff)
Ensure tag used for logging on Android does not contain spaces
Tag passed to __android_log_print shouldn't contain spaces because filter-spec used by adb logcat expects space-separeate list of tag:priority specifiers. Effectively, its not possible to filter tag using logcat if Qt's application name has spaces. Pick-to: 6.2 6.3 Change-Id: I52b706b7a368d0700db45c0406bbfef279bc61fb Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r--src/corelib/global/qlogging.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index e0dbfcf09b..88656e6b86 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1737,9 +1737,10 @@ static bool android_default_message_handler(QtMsgType type,
break;
};
+ // If application name is a tag ensure it has no spaces
// If a category is defined, use it as an Android logging tag
__android_log_print(priority, isDefaultCategory(context.category) ?
- qPrintable(QCoreApplication::applicationName()) : context.category,
+ qPrintable(QCoreApplication::applicationName().replace(" ", "_")) : context.category,
"%s\n", qPrintable(formattedMessage));
return true; // Prevent further output to stderr