/src/mozilla-central/media/mtransport/logging.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | // Original author: ekr@rtfm.com |
8 | | |
9 | | #ifndef logging_h__ |
10 | | #define logging_h__ |
11 | | |
12 | | #include <sstream> |
13 | | #include "mozilla/Logging.h" |
14 | | |
15 | | #ifdef MOZILLA_INTERNAL_API |
16 | | |
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 |
22 | | |
23 | | #define MOZ_MTLOG_MODULE(n) \ |
24 | 0 | static mozilla::LogModule* getLogModule() { \ |
25 | 0 | static mozilla::LazyLogModule log(n); \ |
26 | 0 | return static_cast<mozilla::LogModule*>(log); \ |
27 | 0 | } Unexecuted instantiation: Unified_cpp_signaling_src_jsep0.cpp:mozilla::getLogModule() Unexecuted instantiation: Unified_cpp_src_mediapipeline0.cpp:mozilla::getLogModule() Unexecuted instantiation: Unified_cpp_src_peerconnection0.cpp:mozilla::getLogModule() Unexecuted instantiation: Unified_cpp_signaling_src_sdp0.cpp:mozilla::getLogModule() Unexecuted instantiation: SrtpFlow.cpp:mozilla::getLogModule() Unexecuted instantiation: nricectx.cpp:mozilla::getLogModule() Unexecuted instantiation: nricemediastream.cpp:mozilla::getLogModule() Unexecuted instantiation: nriceresolver.cpp:mozilla::getLogModule() Unexecuted instantiation: nricestunaddr.cpp:mozilla::getLogModule() Unexecuted instantiation: nrinterfaceprioritizer.cpp:getLogModule() Unexecuted instantiation: rlogconnector.cpp:getLogModule() Unexecuted instantiation: transportlayer.cpp:mozilla::getLogModule() Unexecuted instantiation: transportlayerdtls.cpp:mozilla::getLogModule() Unexecuted instantiation: transportlayerice.cpp:mozilla::getLogModule() Unexecuted instantiation: transportlayerlog.cpp:mozilla::getLogModule() Unexecuted instantiation: transportlayerloopback.cpp:mozilla::getLogModule() Unexecuted instantiation: transportlayersrtp.cpp:mozilla::getLogModule() Unexecuted instantiation: mediapipeline_unittest.cpp:getLogModule() Unexecuted instantiation: stunserver.cpp:getLogModule() Unexecuted instantiation: transport_unittests.cpp:getLogModule() |
28 | | |
29 | | #define MOZ_MTLOG(level, b) \ |
30 | 0 | do { \ |
31 | 0 | if (MOZ_LOG_TEST(getLogModule(), level)) { \ |
32 | 0 | std::stringstream str; \ |
33 | 0 | str << b; \ |
34 | 0 | MOZ_LOG(getLogModule(), level, ("%s", str.str().c_str())); \ |
35 | 0 | } \ |
36 | 0 | } 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. |
40 | | |
41 | | #include "prlog.h" |
42 | | |
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 |
48 | | |
49 | | #define MOZ_MTLOG_MODULE(n) \ |
50 | | static PRLogModuleInfo* getLogModule() { \ |
51 | | static PRLogModuleInfo* log; \ |
52 | | if (!log) \ |
53 | | log = PR_NewLogModule(n); \ |
54 | | return log; \ |
55 | | } |
56 | | |
57 | | #define MOZ_MTLOG(level, b) \ |
58 | | do { \ |
59 | | if (PR_LOG_TEST(getLogModule(), level)) { \ |
60 | | std::stringstream str; \ |
61 | | str << b; \ |
62 | | PR_LOG(getLogModule(), level, ("%s", str.str().c_str())); \ |
63 | | } \ |
64 | | } while(0) |
65 | | #endif // MOZILLA_INTERNAL_API |
66 | | #endif // logging_h__ |