Bumping manifests a=b2g-bump
[gecko.git] / media / mtransport / logging.h
blob86c9549edbb1d7a639a969648889acd67ddd5f67
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 <prlog.h>
15 #if defined(PR_LOGGING)
17 #define ML_EMERG 1
18 #define ML_ERROR 2
19 #define ML_WARNING 3
20 #define ML_NOTICE 4
21 #define ML_INFO 5
22 #define ML_DEBUG 6
24 // PR_LOGGING is on --> make useful MTLOG macros
25 #define MOZ_MTLOG_MODULE(n) \
26 static PRLogModuleInfo* getLogModule() { \
27 static PRLogModuleInfo* log; \
28 if (!log) \
29 log = PR_NewLogModule(n); \
30 return log; \
33 #define MOZ_MTLOG(level, b) \
34 do { \
35 std::stringstream str; \
36 str << b; \
37 PR_LOG(getLogModule(), level, ("%s", str.str().c_str())); } while(0)
39 #else
40 // PR_LOGGING is off --> make no-op MTLOG macros
41 #define MOZ_MTLOG_MODULE(n)
42 #define MOZ_MTLOG(level, b)
43 #endif // defined(PR_LOGGING)
45 #endif // logging_h__