1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_net_CookieLogging_h
7 #define mozilla_net_CookieLogging_h
9 #include "mozilla/Logging.h"
12 class nsIConsoleReportCollector
;
18 // define logging macros for convenience
19 #define SET_COOKIE true
20 #define GET_COOKIE false
22 extern LazyLogModule gCookieLog
;
24 #define COOKIE_LOGFAILURE(a, b, c, d) CookieLogging::LogFailure(a, b, c, d)
25 #define COOKIE_LOGSUCCESS(a, b, c, d, e) \
26 CookieLogging::LogSuccess(a, b, c, d, e)
28 #define COOKIE_LOGEVICTED(a, details) \
30 if (MOZ_LOG_TEST(gCookieLog, LogLevel::Debug)) \
31 CookieLogging::LogEvicted(a, details); \
34 #define COOKIE_LOGSTRING(lvl, fmt) \
36 MOZ_LOG(gCookieLog, lvl, fmt); \
37 MOZ_LOG(gCookieLog, lvl, ("\n")); \
42 class CookieLogging final
{
44 static void LogSuccess(bool aSetCookie
, nsIURI
* aHostURI
,
45 const nsACString
& aCookieString
, Cookie
* aCookie
,
48 static void LogFailure(bool aSetCookie
, nsIURI
* aHostURI
,
49 const nsACString
& aCookieString
, const char* aReason
);
51 static void LogCookie(Cookie
* aCookie
);
53 static void LogEvicted(Cookie
* aCookie
, const char* aDetails
);
55 static void LogMessageToConsole(nsIConsoleReportCollector
* aCRC
, nsIURI
* aURI
,
57 const nsACString
& aCategory
,
58 const nsACString
& aMsg
,
59 const nsTArray
<nsString
>& aParams
);
63 } // namespace mozilla
65 #endif // mozilla_net_CookieLogging_h