1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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/. */
10 #include "mozilla/Maybe.h"
11 #include "mozilla/dom/DOMTypes.h"
14 namespace mozilla::dom
{
18 static void Print(char const* aLocation
, const nsAString
& aMsg
,
19 ClonedMessageData
const& aData
) {
20 if (MOZ_UNLIKELY(MOZ_LOG_TEST(MMPrinter::sMMLog
, LogLevel::Debug
))) {
21 Maybe
<uint64_t> msgId
= MMPrinter::PrintHeader(aLocation
, aMsg
);
22 if (!msgId
.isSome()) {
25 MMPrinter::PrintData(*msgId
, aData
);
29 static void Print(char const* aLocation
, const nsACString
& aActorName
,
30 const nsAString
& aMessageName
,
31 const Maybe
<ClonedMessageData
>& aData
) {
32 if (MOZ_UNLIKELY(MOZ_LOG_TEST(MMPrinter::sMMLog
, LogLevel::Debug
))) {
33 Maybe
<uint64_t> msgId
= MMPrinter::PrintHeader(
35 NS_ConvertUTF8toUTF16(aActorName
+ " - "_ns
) + aMessageName
);
37 if (!msgId
.isSome()) {
42 MMPrinter::PrintData(*msgId
, *aData
);
44 MMPrinter::PrintNoData(*msgId
);
50 static LazyLogModule sMMLog
;
51 static Maybe
<uint64_t> PrintHeader(char const* aLocation
,
52 const nsAString
& aMsg
);
53 static void PrintNoData(uint64_t aMsgId
);
54 static void PrintData(uint64_t aMsgId
, ClonedMessageData
const& aData
);
57 } // namespace mozilla::dom
59 #endif /* MMPrinter_h */