Bug 1869043 assert that graph set access is main thread only r=padenot
[gecko.git] / netwerk / cookie / CookieLogging.h
blob19721914c8663e029bb1789d67b1196e5bb3633c
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"
10 #include "nsString.h"
12 class nsIConsoleReportCollector;
13 class nsIURI;
15 namespace mozilla {
16 namespace net {
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) \
29 PR_BEGIN_MACRO \
30 if (MOZ_LOG_TEST(gCookieLog, LogLevel::Debug)) \
31 CookieLogging::LogEvicted(a, details); \
32 PR_END_MACRO
34 #define COOKIE_LOGSTRING(lvl, fmt) \
35 PR_BEGIN_MACRO \
36 MOZ_LOG(gCookieLog, lvl, fmt); \
37 MOZ_LOG(gCookieLog, lvl, ("\n")); \
38 PR_END_MACRO
40 class Cookie;
42 class CookieLogging final {
43 public:
44 static void LogSuccess(bool aSetCookie, nsIURI* aHostURI,
45 const nsACString& aCookieString, Cookie* aCookie,
46 bool aReplacing);
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,
56 uint32_t aErrorFlags,
57 const nsACString& aCategory,
58 const nsACString& aMsg,
59 const nsTArray<nsString>& aParams);
62 } // namespace net
63 } // namespace mozilla
65 #endif // mozilla_net_CookieLogging_h