Skip to content

Commit

Permalink
Fix grouping of console logs (#37835)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37835

Chrome Dev Tools doesn't correctly display grouped console logs (i.e. console output between a `console.group` and `console.groupEnd`) when timestamps are all zero.

Populate the timestamp field so grouping functions as expected.

Changelog: [General] [Fixed] Fix timestamps and grouped display of console messages within in a `console.group`

Reviewed By: fbmal7

Differential Revision: D46605659

fbshipit-source-id: c5821bfb4807c7f0ce28b7bb95ea08de29caf8a2
  • Loading branch information
Matt Blagden authored and facebook-github-bot committed Jun 27, 2023
1 parent 37460b0 commit 48791bc
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ void Connection::Impl::onMessageAdded(
const ConsoleMessageInfo &info) {
m::runtime::ConsoleAPICalledNotification apiCalledNote;
apiCalledNote.type = info.level;
apiCalledNote.timestamp =
std::chrono::duration<double, std::ratio<1, 1000>>(
std::chrono::system_clock::now().time_since_epoch())
.count();
// TODO(jpporto): fix test cases sending invalid context id.
// apiCalledNote.executionContextId = kHermesExecutionContextId;

Expand Down

0 comments on commit 48791bc

Please sign in to comment.