forked from mirrors/gecko-dev
Bug 1543501 - Make MOZ_DBG() work on Android. r=heycam
stderr does not go anywhere by default on Android. Debugging output is conventionally sent to the Android log via special functions like __android_log_print. We already have logic for handling this in nsCRTGlue's printf_stderr, but I don't think we can use that in MFBT. Differential Revision: https://phabricator.services.mozilla.com/D26985 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
422903589d
commit
55b741f5f7
1 changed files with 8 additions and 0 deletions
|
|
@ -18,6 +18,10 @@
|
|||
template <typename T>
|
||||
class nsTSubstring;
|
||||
|
||||
#ifdef ANDROID
|
||||
# include <android/log.h>
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace detail {
|
||||
|
|
@ -92,7 +96,11 @@ auto&& MozDbg(const char* aFile, int aLine, const char* aExpression,
|
|||
s << "[MozDbg] [" << aFile << ':' << aLine << "] " << aExpression << " = ";
|
||||
mozilla::DebugValue(s, std::forward<T>(aValue));
|
||||
s << '\n';
|
||||
#ifdef ANDROID
|
||||
__android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", s.str().c_str());
|
||||
#else
|
||||
fputs(s.str().c_str(), stderr);
|
||||
#endif
|
||||
return std::forward<T>(aValue);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue