OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/test/chromedriver/base_logger.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/json/json_writer.h" | |
10 #include "base/values.h" | |
11 #include "chrome/test/chromedriver/chrome/log.h" | |
12 | |
13 BaseLogger::BaseLogger(Log* log) | |
14 : log_(log) {} | |
15 | |
16 void BaseLogger::AddLogEntry( | |
samuong
2017/03/27 18:42:10
I'm not sure this should be a separate base class.
| |
17 Log::Level level, | |
18 const std::string& webview, | |
19 const std::string& method, | |
20 const base::DictionaryValue& params) { | |
21 base::DictionaryValue log_message_dict; | |
22 log_message_dict.SetString("webview", webview); | |
23 log_message_dict.SetString("message.method", method); | |
24 log_message_dict.Set("message.params", params.DeepCopy()); | |
25 std::string log_message_json; | |
26 base::JSONWriter::Write(log_message_dict, &log_message_json); | |
27 | |
28 // TODO(klm): extract timestamp from params? | |
29 // Look at where it is for Page, Network, Timeline, and trace events. | |
30 log_->AddEntry(level, log_message_json); | |
31 } | |
32 | |
33 void BaseLogger::AddLogEntry( | |
34 const std::string& webview, | |
35 const std::string& method, | |
36 const base::DictionaryValue& params) { | |
37 AddLogEntry(Log::kInfo, webview, method, params); | |
38 } | |
OLD | NEW |