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

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: 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
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/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 16
17 using base::DictionaryValue; 17 using base::DictionaryValue;
18 using base::ListValue; 18 using base::ListValue;
19 using base::Value; 19 using base::Value;
20 20
21 namespace webdriver { 21 namespace webdriver {
22 22
23 FileLog* FileLog::singleton_ = NULL; 23 FileLog* FileLog::singleton_ = NULL;
24 24
25 double start_time = 0; 25 double start_time = 0;
26 26
27 LogLevel LogLevelFromString(const std::string& name) {
28 // Default logging level is INFO.
29 LogLevel level = kInfoLogLevel;
kkania 2012/05/21 17:46:46 If they pass "OFF", this will get set to INFO, whi
zori 2012/05/21 23:42:33 I think FINEST->ALL. On 2012/05/21 17:46:46, kkan
30 if (name == "SEVERE") {
kkania 2012/05/21 17:46:46 although the doc seems to suggest it will be caps,
zori 2012/05/21 23:42:33 Done.
31 level = kSevereLogLevel;
32 } else if (name == "WARNING") {
33 level = kWarningLogLevel;
34 } else if (name == "FINE") {
35 level = kFineLogLevel;
36 } else if (name == "FINER") {
37 level = kFinerLogLevel;
38 }
39 return level;
40 }
41
27 // static 42 // static
28 bool LogType::FromString(const std::string& name, LogType* log_type) { 43 bool LogType::FromString(const std::string& name, LogType* log_type) {
29 if (name == "driver") { 44 if (name == "driver") {
30 *log_type = LogType(kDriver); 45 *log_type = LogType(kDriver);
31 } else { 46 } else {
32 return false; 47 return false;
33 } 48 }
34 return true; 49 return true;
35 } 50 }
36 51
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 log = FileLog::CreateFileLog(FILE_PATH_LITERAL("chromedriver.log"), 236 log = FileLog::CreateFileLog(FILE_PATH_LITERAL("chromedriver.log"),
222 min_log_level); 237 min_log_level);
223 } else { 238 } else {
224 log = new FileLog(log_path, min_log_level); 239 log = new FileLog(log_path, min_log_level);
225 } 240 }
226 FileLog::SetGlobalLog(log); 241 FileLog::SetGlobalLog(log);
227 return log->IsOpen(); 242 return log->IsOpen();
228 } 243 }
229 244
230 } // namespace webdriver 245 } // namespace webdriver
OLDNEW
« chrome/test/webdriver/webdriver_logging.h ('K') | « chrome/test/webdriver/webdriver_logging.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698