michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim:set ts=4 sw=4 sts=4 et cin: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef HttpLog_h__ michael@0: #define HttpLog_h__ michael@0: michael@0: michael@0: /******************************************************************************* michael@0: * This file should ONLY be #included by source (.cpp) files in the /http michael@0: * directory, not headers (.h). If you need to use LOG() in a .h file, call michael@0: * PR_LOG directly. michael@0: * michael@0: * This file should also be the first #include in your file. michael@0: * michael@0: * Yes, this is kludgy. michael@0: *******************************************************************************/ michael@0: michael@0: michael@0: // e10s mess: IPDL-generated headers include chromium files that both #include michael@0: // prlog.h, and #define LOG in conflict with this file. michael@0: // Solution: (as described in bug 545995) michael@0: // 1) ensure that this file is #included before any IPDL-generated files and michael@0: // anything else that #includes prlog.h, so that we can make sure prlog.h michael@0: // sees FORCE_PR_LOG michael@0: // 2) #include IPDL boilerplate, and then undef LOG so our LOG wins. michael@0: // 3) nsNetModule.cpp does its own crazy stuff with #including prlog.h michael@0: // multiple times; allow it to define ALLOW_LATE_HTTPLOG_H_INCLUDE to bypass michael@0: // check. michael@0: #if defined(PR_LOG) && !defined(ALLOW_LATE_HTTPLOG_H_INCLUDE) michael@0: #error "If HttpLog.h #included it must come before any IPDL-generated files or other files that #include prlog.h" michael@0: #endif michael@0: michael@0: // NeckoChild.h will include chromium, which will include prlog.h so define michael@0: // PR_FORCE before we do that. michael@0: #if defined(MOZ_LOGGING) michael@0: #define FORCE_PR_LOG michael@0: #endif michael@0: michael@0: #include "mozilla/net/NeckoChild.h" michael@0: michael@0: // Get rid of Chromium's LOG definition michael@0: #undef LOG michael@0: michael@0: #if defined(PR_LOGGING) michael@0: // michael@0: // Log module for HTTP Protocol logging... michael@0: // michael@0: // To enable logging (see prlog.h for full details): michael@0: // michael@0: // set NSPR_LOG_MODULES=nsHttp:5 michael@0: // set NSPR_LOG_FILE=http.log michael@0: // michael@0: // this enables PR_LOG_ALWAYS level information and places all output in michael@0: // the file http.log michael@0: // michael@0: extern PRLogModuleInfo *gHttpLog; michael@0: #endif michael@0: michael@0: // http logging michael@0: #define LOG1(args) PR_LOG(gHttpLog, 1, args) michael@0: #define LOG2(args) PR_LOG(gHttpLog, 2, args) michael@0: #define LOG3(args) PR_LOG(gHttpLog, 3, args) michael@0: #define LOG4(args) PR_LOG(gHttpLog, 4, args) michael@0: #define LOG5(args) PR_LOG(gHttpLog, 5, args) michael@0: #define LOG(args) LOG4(args) michael@0: michael@0: #define LOG1_ENABLED() PR_LOG_TEST(gHttpLog, 1) michael@0: #define LOG2_ENABLED() PR_LOG_TEST(gHttpLog, 2) michael@0: #define LOG3_ENABLED() PR_LOG_TEST(gHttpLog, 3) michael@0: #define LOG4_ENABLED() PR_LOG_TEST(gHttpLog, 4) michael@0: #define LOG5_ENABLED() PR_LOG_TEST(gHttpLog, 5) michael@0: #define LOG_ENABLED() LOG4_ENABLED() michael@0: michael@0: #endif // HttpLog_h__