diff --git a/media/mtransport/logging.h b/media/mtransport/logging.h index d8cbe5a7183c..c2e7552f5bf3 100644 --- a/media/mtransport/logging.h +++ b/media/mtransport/logging.h @@ -24,7 +24,21 @@ static mozilla::LazyLogModule log(n); \ return static_cast(log); \ } + +#define MOZ_MTLOG(level, b) \ + do { \ + if (MOZ_LOG_TEST(getLogModule(), level)) { \ + std::stringstream str; \ + str << b; \ + MOZ_LOG(getLogModule(), level, ("%s", str.str().c_str())); \ + } \ + } while(0) #else +// When building mtransport outside of XUL, for example in stand-alone gtests, +// PR_Logging needs to be used instead of mozilla logging. + +#include "prlog.h" + #define MOZ_MTLOG_MODULE(n) \ static PRLogModuleInfo* getLogModule() { \ static PRLogModuleInfo* log; \ @@ -32,15 +46,14 @@ log = PR_NewLogModule(n); \ return log; \ } -#endif -#define MOZ_MTLOG(level, b) \ - do { \ - if (MOZ_LOG_TEST(getLogModule(), level)) { \ - std::stringstream str; \ - str << b; \ - MOZ_LOG(getLogModule(), level, ("%s", str.str().c_str())); \ - } \ +#define MOZ_MTLOG(level, b) \ + do { \ + if (PR_LOG_TEST(getLogModule(), (PRLogModuleLevel)level)) { \ + std::stringstream str; \ + str << b; \ + PR_LOG(getLogModule(), (PRLogModuleLevel)level, ("%s", str.str().c_str())); \ + } \ } while(0) - +#endif // MOZILLA_INTERNAL_API #endif // logging_h__