Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsWyciwyg_h__
6 #define nsWyciwyg_h__
8 #if defined(MOZ_LOGGING)
9 #define FORCE_PR_LOG
10 #endif
12 // e10s mess: IPDL-generatd headers include chromium which both #includes
13 // prlog.h, and #defines LOG in conflict with this file.
14 // Solution: (as described in bug 545995)
15 // 1) ensure that this file is #included before any IPDL-generated files and
16 // anything else that #includes prlog.h, so that we can make sure prlog.h
17 // sees FORCE_PR_LOG if needed.
18 // 2) #include IPDL boilerplate, and then undef LOG so our LOG wins.
19 // 3) nsNetModule.cpp does its own crazy stuff with #including prlog.h
20 // multiple times; allow it to define ALLOW_LATE_NSHTTP_H_INCLUDE to bypass
21 // check.
22 #if defined(PR_LOG) && !defined(ALLOW_LATE_NSHTTP_H_INCLUDE)
23 #error "If nsWyciwyg.h #included it must come before any IPDL-generated files or other files that #include prlog.h"
24 #endif
25 #include "mozilla/net/NeckoChild.h"
26 #undef LOG
28 #include "prlog.h"
30 #if defined(PR_LOGGING)
31 //
32 // Log module for HTTP Protocol logging...
33 //
34 // To enable logging (see prlog.h for full details):
35 //
36 // set NSPR_LOG_MODULES=nsWyciwyg:5
37 // set NSPR_LOG_FILE=wyciwyg.log
38 //
39 // this enables PR_LOG_ALWAYS level information and places all output in
40 // the file wyciwyg.log
41 //
42 extern PRLogModuleInfo *gWyciwygLog;
43 #endif
45 // http logging
46 #define LOG1(args) PR_LOG(gWyciwygLog, 1, args)
47 #define LOG2(args) PR_LOG(gWyciwygLog, 2, args)
48 #define LOG3(args) PR_LOG(gWyciwygLog, 3, args)
49 #define LOG4(args) PR_LOG(gWyciwygLog, 4, args)
50 #define LOG(args) LOG4(args)
52 #define LOG1_ENABLED() PR_LOG_TEST(gWyciwygLog, 1)
53 #define LOG2_ENABLED() PR_LOG_TEST(gWyciwygLog, 2)
54 #define LOG3_ENABLED() PR_LOG_TEST(gWyciwygLog, 3)
55 #define LOG4_ENABLED() PR_LOG_TEST(gWyciwygLog, 4)
56 #define LOG_ENABLED() LOG4_ENABLED()
58 #define WYCIWYG_TYPE "text/html"
60 #endif // nsWyciwyg_h__