Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit f2c850a

Browse files
committed
Add more logs to help debug event missing issue
In this change we 1) specify the event id range of dropped events, 2) Add a logline when logEvent failed and returned 0. 3) Specify the range of event_id of events fetched and flushing out
1 parent 2468803 commit f2c850a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/lib/profiles/data-management/Current/LoggingManagement.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,10 @@ event_id_t LoggingManagement::LogEvent(const EventSchema & inSchema, EventWriter
10941094

10951095
exit:
10961096
Platform::CriticalSectionExit();
1097+
if (event_id == 0)
1098+
{
1099+
WeaveLogProgress(EventLogging, "Failed to log event with ProfileId: %d, return event id 0", inSchema.mProfileId);
1100+
}
10971101
return event_id;
10981102
}
10991103

@@ -2117,7 +2121,9 @@ void CircularEventBuffer::AddEventUTC(utc_timestamp_t inEventTimestamp)
21172121

21182122
void CircularEventBuffer::RemoveEvent(size_t aNumEvents)
21192123
{
2124+
event_id_t currentFirstEventID = mFirstEventID;
21202125
mFirstEventID += aNumEvents;
2126+
WeaveLogDetail(EventLogging, "Dropping events | Move first event id from %u to %u", currentFirstEventID, mFirstEventID);
21212127
}
21222128

21232129
/**

src/lib/profiles/data-management/Current/NotificationEngine.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,8 @@ WEAVE_ERROR NotificationEngine::BuildSingleNotifyRequestEventList(SubscriptionHa
12261226
event_id_t tmp_id = logger.GetFirstEventID(static_cast<ImportanceType>(i + 1));
12271227
if (tmp_id > initialEvents[i])
12281228
{
1229+
WeaveLogProgress(DataManagement, "BuildSingleNotifyRequestEventList | Missing event_id range: { %u, %u };",
1230+
initialEvents[i], tmp_id - 1);
12291231
initialEvents[i] = tmp_id;
12301232
}
12311233
}
@@ -1342,6 +1344,8 @@ WEAVE_ERROR NotificationEngine::BuildSingleNotifyRequestEventList(SubscriptionHa
13421344
if (aSubHandler->mSelfVendedEvents[i] > initialEvents[i])
13431345
{
13441346
event_count += aSubHandler->mSelfVendedEvents[i] - initialEvents[i];
1347+
WeaveLogProgress(DataManagement, "Fetched events [importance: %d, event_id: %u - %u]",
1348+
i, initialEvents[i], aSubHandler->mSelfVendedEvents[i] - 1);
13451349
}
13461350
}
13471351

0 commit comments

Comments
 (0)