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

Side by Side Diff: chrome/test/webdriver/webdriver_logging.cc

Issue 10411031: Fixing loglevel in chrome driver to accept string rather than an integer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "Changes on LogLevelFromString()." Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/webdriver/webdriver_logging.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/test/webdriver/webdriver_logging.h" 5 #include "chrome/test/webdriver/webdriver_logging.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/string_util.h"
13 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
14 #include "base/time.h" 15 #include "base/time.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 17
17 using base::DictionaryValue; 18 using base::DictionaryValue;
18 using base::ListValue; 19 using base::ListValue;
19 using base::Value; 20 using base::Value;
20 21
21 namespace webdriver { 22 namespace webdriver {
22 23
23 FileLog* FileLog::singleton_ = NULL; 24 FileLog* FileLog::singleton_ = NULL;
24 25
25 double start_time = 0; 26 double start_time = 0;
26 27
28 LogLevel LogLevelFromString(const std::string& name) {
29 // Default logging level is INFO.
30 LogLevel level = kInfoLogLevel;
31 const std::string upper_case_name = StringToUpperASCII(name);
32 if (upper_case_name == "OFF" || upper_case_name == "SEVERE") {
33 level = kSevereLogLevel;
kkania 2012/05/22 16:09:01 I think OFF should be a separate level. We shouldn
34 } else if (upper_case_name == "WARNING") {
35 level = kWarningLogLevel;
36 } else if (upper_case_name == "INFO" || upper_case_name == "CONFIG") {
37
38 } else if (upper_case_name == "FINE") {
39 level = kFineLogLevel;
40 } else if (upper_case_name == "FINER") {
41 level = kFinerLogLevel;
42 } else if (upper_case_name == "ALL" || upper_case_name == "FINEST") {
43 level = kAllLogLevel;
44 }
45 return level;
46 }
47
27 // static 48 // static
28 bool LogType::FromString(const std::string& name, LogType* log_type) { 49 bool LogType::FromString(const std::string& name, LogType* log_type) {
29 if (name == "driver") { 50 if (name == "driver") {
30 *log_type = LogType(kDriver); 51 *log_type = LogType(kDriver);
31 } else { 52 } else {
32 return false; 53 return false;
33 } 54 }
34 return true; 55 return true;
35 } 56 }
36 57
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 log = FileLog::CreateFileLog(FILE_PATH_LITERAL("chromedriver.log"), 242 log = FileLog::CreateFileLog(FILE_PATH_LITERAL("chromedriver.log"),
222 min_log_level); 243 min_log_level);
223 } else { 244 } else {
224 log = new FileLog(log_path, min_log_level); 245 log = new FileLog(log_path, min_log_level);
225 } 246 }
226 FileLog::SetGlobalLog(log); 247 FileLog::SetGlobalLog(log);
227 return log->IsOpen(); 248 return log->IsOpen();
228 } 249 }
229 250
230 } // namespace webdriver 251 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_logging.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698