tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

HttpLog.h (2760B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=4 sw=2 sts=2 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 Maybe<nsCString> CallingScriptLocationString();
     39 void LogCallingScriptLocation(void* instance);
     40 void LogCallingScriptLocation(void* instance,
     41                              const Maybe<nsCString>& aLogLocation);
     42 extern LazyLogModule gHttpLog;
     43 extern LazyLogModule gHttpIOLog;
     44 extern LazyLogModule gDictionaryLog;
     45 }  // namespace net
     46 }  // namespace mozilla
     47 
     48 // http logging
     49 #define LOG1(args) \
     50  MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Error, args)
     51 #define LOG2(args) \
     52  MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Warning, args)
     53 #define LOG3(args) \
     54  MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Info, args)
     55 #define LOG4(args) \
     56  MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Debug, args)
     57 #define LOG5(args) \
     58  MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Verbose, args)
     59 #define LOG(args) LOG4(args)
     60 #define LOGTIME(start, args) \
     61  MOZ_LOG_TIME(mozilla::net::gHttpLog, mozilla::LogLevel::Debug, &(start), args)
     62 
     63 #define LOG1_ENABLED() \
     64  MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Error)
     65 #define LOG2_ENABLED() \
     66  MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Warning)
     67 #define LOG3_ENABLED() \
     68  MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Info)
     69 #define LOG4_ENABLED() \
     70  MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Debug)
     71 #define LOG5_ENABLED() \
     72  MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Verbose)
     73 #define LOG_ENABLED() LOG4_ENABLED()
     74 
     75 #define LOG_DICTIONARIES(args) \
     76  MOZ_LOG(mozilla::net::gDictionaryLog, mozilla::LogLevel::Debug, args)
     77 
     78 #endif  // HttpLog_h__