Bug 1652557: don't skip test_bug767684.html when xorigin iframes and fission are...
[gecko.git] / media / mtransport / logging.h
blob98cbd13819e64a2fc491678d60b02b1a7d991548
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 // Original author: ekr@rtfm.com
9 #ifndef logging_h__
10 #define logging_h__
12 #include <sstream>
13 #include "mozilla/Logging.h"
15 #ifdef MOZILLA_INTERNAL_API
17 # define ML_ERROR mozilla::LogLevel::Error
18 # define ML_WARNING mozilla::LogLevel::Warning
19 # define ML_NOTICE mozilla::LogLevel::Info
20 # define ML_INFO mozilla::LogLevel::Debug
21 # define ML_DEBUG mozilla::LogLevel::Verbose
23 # define MOZ_MTLOG_MODULE(n) \
24 static mozilla::LogModule* getLogModule() { \
25 static mozilla::LazyLogModule log(n); \
26 return static_cast<mozilla::LogModule*>(log); \
29 # define MOZ_MTLOG(level, b) \
30 do { \
31 if (MOZ_LOG_TEST(getLogModule(), level)) { \
32 std::stringstream str; \
33 str << b; \
34 MOZ_LOG(getLogModule(), level, ("%s", str.str().c_str())); \
35 } \
36 } while (0)
37 #else
38 // When building mtransport outside of XUL, for example in stand-alone gtests,
39 // PR_Logging needs to be used instead of mozilla logging.
41 # include "prlog.h"
43 # define ML_ERROR PR_LOG_ERROR
44 # define ML_WARNING PR_LOG_WARNING
45 # define ML_NOTICE PR_LOG_INFO
46 # define ML_INFO PR_LOG_DEBUG
47 # define ML_DEBUG PR_LOG_VERBOSE
49 # define MOZ_MTLOG_MODULE(n) \
50 static PRLogModuleInfo* getLogModule() { \
51 static PRLogModuleInfo* log; \
52 if (!log) log = PR_NewLogModule(n); \
53 return log; \
56 # define MOZ_MTLOG(level, b) \
57 do { \
58 if (PR_LOG_TEST(getLogModule(), level)) { \
59 std::stringstream str; \
60 str << b; \
61 PR_LOG(getLogModule(), level, ("%s", str.str().c_str())); \
62 } \
63 } while (0)
64 #endif // MOZILLA_INTERNAL_API
65 #endif // logging_h__