Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1702)

Unified Diff: chrome/test/chromedriver/base_logger.cc

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: New DevToolsEventsLogger Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/chromedriver/base_logger.cc
diff --git a/chrome/test/chromedriver/base_logger.cc b/chrome/test/chromedriver/base_logger.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f5cb2a2b3483d71a0558460683005ec5cd85c476
--- /dev/null
+++ b/chrome/test/chromedriver/base_logger.cc
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/test/chromedriver/base_logger.h"
+
+#include <string>
+
+#include "base/json/json_writer.h"
+#include "base/values.h"
+#include "chrome/test/chromedriver/chrome/log.h"
+
+BaseLogger::BaseLogger(Log* log)
+ : log_(log) {}
+
+void BaseLogger::AddLogEntry(
samuong 2017/03/27 18:42:10 I'm not sure this should be a separate base class.
+ Log::Level level,
+ const std::string& webview,
+ const std::string& method,
+ const base::DictionaryValue& params) {
+ base::DictionaryValue log_message_dict;
+ log_message_dict.SetString("webview", webview);
+ log_message_dict.SetString("message.method", method);
+ log_message_dict.Set("message.params", params.DeepCopy());
+ std::string log_message_json;
+ base::JSONWriter::Write(log_message_dict, &log_message_json);
+
+ // TODO(klm): extract timestamp from params?
+ // Look at where it is for Page, Network, Timeline, and trace events.
+ log_->AddEntry(level, log_message_json);
+}
+
+void BaseLogger::AddLogEntry(
+ const std::string& webview,
+ const std::string& method,
+ const base::DictionaryValue& params) {
+ AddLogEntry(Log::kInfo, webview, method, params);
+}

Powered by Google App Engine
This is Rietveld 408576698