1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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/. */
7 #include "DDLogMessage.h"
9 #include "DDLifetimes.h"
13 nsCString
DDLogMessage::Print() const {
15 str
.AppendPrintf("%" PRImi
" | %f | %s[%p] | %s | %s | ", mIndex
.Value(),
16 ToSeconds(mTimeStamp
), mObject
.TypeName(), mObject
.Pointer(),
17 ToShortString(mCategory
), mLabel
);
18 AppendToString(mValue
, str
);
22 nsCString
DDLogMessage::Print(const DDLifetimes
& aLifetimes
) const {
24 const DDLifetime
* lifetime
= aLifetimes
.FindLifetime(mObject
, mIndex
);
25 str
.AppendPrintf("%" PRImi
" | %f | ", mIndex
.Value(), ToSeconds(mTimeStamp
));
26 lifetime
->AppendPrintf(str
);
27 str
.AppendPrintf(" | %s | %s | ", ToShortString(mCategory
), mLabel
);
28 if (!mValue
.is
<DDLogObject
>()) {
29 AppendToString(mValue
, str
);
31 const DDLifetime
* lifetime2
=
32 aLifetimes
.FindLifetime(mValue
.as
<DDLogObject
>(), mIndex
);
34 lifetime2
->AppendPrintf(str
);
36 AppendToString(mValue
, str
);
42 } // namespace mozilla