OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/test/chromedriver/logging.h" | 12 #include "chrome/test/chromedriver/logging.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Truncates the given string to 200 characters, adding an ellipsis if | 16 // Truncates the given string to 200 characters, adding an ellipsis if |
17 // truncation was necessary. | 17 // truncation was necessary. |
18 void TruncateString(std::string* data) { | 18 void TruncateString(std::string* data) { |
19 const size_t kMaxLength = 200; | 19 const size_t kMaxLength = 200; |
20 if (data->length() > kMaxLength) { | 20 if (data->length() > kMaxLength) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 base::StringPrintf("[%.3lf][%s]: %s", | 124 base::StringPrintf("[%.3lf][%s]: %s", |
125 base::TimeDelta(timestamp - start_).InSecondsF(), | 125 base::TimeDelta(timestamp - start_).InSecondsF(), |
126 level_name, | 126 level_name, |
127 ConvertForDisplay(message).c_str()); | 127 ConvertForDisplay(message).c_str()); |
128 const char* format = "%s\n"; | 128 const char* format = "%s\n"; |
129 if (entry[entry.length() - 1] == '\n') | 129 if (entry[entry.length() - 1] == '\n') |
130 format = "%s"; | 130 format = "%s"; |
131 fprintf(stderr, format, entry.c_str()); | 131 fprintf(stderr, format, entry.c_str()); |
132 fflush(stderr); | 132 fflush(stderr); |
133 } | 133 } |
OLD | NEW |