Skip to content

Commit

Permalink
Fix JSON dictionary for console log events. (#2982)
Browse files Browse the repository at this point in the history
This fixes the JSON structure for console log events to have an 'entry'
dictionary.

b/335243086
  • Loading branch information
jellefoks authored Apr 18, 2024
1 parent f19055a commit 566bba1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cobalt/debug/backend/log_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@

#include "cobalt/debug/backend/log_agent.h"

#include <utility>

#include "base/bind.h"
#include "base/logging.h"
#include "base/values.h"
#include "cobalt/debug/console/command_manager.h"

namespace cobalt {
Expand Down Expand Up @@ -86,9 +89,11 @@ bool LogAgent::OnLogMessage(int severity, const char* file, int line,
// except it only shows up in the debug console and not in remote devtools.
// TODO: Flesh out the rest of LogEntry properties (source, timestamp)
JSONObject params;
params.Set("entry.source", "other");
params.Set("entry.text", str);
params.Set("entry.level", GetLogLevelFromSeverity(severity));
base::Value::Dict entry;
entry.Set("source", "other");
entry.Set("text", str);
entry.Set("level", GetLogLevelFromSeverity(severity));
params.Set("entry", std::move(entry));
dispatcher_->SendEvent(event_method_, params);
}

Expand Down

0 comments on commit 566bba1

Please sign in to comment.