1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim:set ts=4 sw=4 sts=4 et cin: */
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
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef HttpLog_h__
8 #define HttpLog_h__
9 
10 /*******************************************************************************
11  *  This file should ONLY be #included by source (.cpp) files in the /http
12  *  directory, not headers (.h).  If you need to use LOG() in a .h file, call
13  *  PR_LOG directly.
14  *
15  *  This file should also be the first #include in your file.
16  *
17  *  Yes, this is kludgy.
18  *******************************************************************************/
19 
20 #include "mozilla/net/NeckoChild.h"
21 
22 // Get rid of Chromium's LOG definition
23 #undef LOG
24 
25 //
26 // Log module for HTTP Protocol logging...
27 //
28 // To enable logging (see prlog.h for full details):
29 //
30 //    set MOZ_LOG=nsHttp:5
31 //    set MOZ_LOG_FILE=http.log
32 //
33 // This enables LogLevel::Debug level information and places all output in
34 // the file http.log.
35 //
36 namespace mozilla {
37 namespace net {
38 extern LazyLogModule gHttpLog;
39 }
40 }  // namespace mozilla
41 
42 // http logging
43 #define LOG1(args) \
44   MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Error, args)
45 #define LOG2(args) \
46   MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Warning, args)
47 #define LOG3(args) \
48   MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Info, args)
49 #define LOG4(args) \
50   MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Debug, args)
51 #define LOG5(args) \
52   MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Verbose, args)
53 #define LOG(args) LOG4(args)
54 
55 #define LOG1_ENABLED() \
56   MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Error)
57 #define LOG2_ENABLED() \
58   MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Warning)
59 #define LOG3_ENABLED() \
60   MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Info)
61 #define LOG4_ENABLED() \
62   MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Debug)
63 #define LOG5_ENABLED() \
64   MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Verbose)
65 #define LOG_ENABLED() LOG4_ENABLED()
66 
67 #endif  // HttpLog_h__
68