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

Side by Side Diff: chrome/common/logging_chrome.cc

Issue 1136463009: Allow --v and --log-level switches simultaneous usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge if's. Created 5 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
« no previous file with comments | « no previous file | 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 // Need to include this before most other files because it defines 7 // Need to include this before most other files because it defines
8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define
9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the
10 // ViewMsgLog et al. functions. 10 // ViewMsgLog et al. functions.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 326
327 // We call running in unattended mode "headless", and allow 327 // We call running in unattended mode "headless", and allow
328 // headless mode to be configured either by the Environment 328 // headless mode to be configured either by the Environment
329 // Variable or by the Command Line Switch. This is for 329 // Variable or by the Command Line Switch. This is for
330 // automated test purposes. 330 // automated test purposes.
331 scoped_ptr<base::Environment> env(base::Environment::Create()); 331 scoped_ptr<base::Environment> env(base::Environment::Create());
332 if (env->HasVar(env_vars::kHeadless) || 332 if (env->HasVar(env_vars::kHeadless) ||
333 command_line.HasSwitch(switches::kNoErrorDialogs)) 333 command_line.HasSwitch(switches::kNoErrorDialogs))
334 SuppressDialogs(); 334 SuppressDialogs();
335 335
336 // Use a minimum log level if the command line asks for one, 336 // Use a minimum log level if the command line asks for one. Ignore this
337 // otherwise leave it at the default level (INFO). 337 // switch if there's vlog level switch present too (as both of these switches
338 if (command_line.HasSwitch(switches::kLoggingLevel)) { 338 // refer to the same underlying log level, and the vlog level switch has
339 std::string log_level = command_line.GetSwitchValueASCII( 339 // already been processed inside logging::InitLogging). If there is neither
340 switches::kLoggingLevel); 340 // log level nor vlog level specified, then just leave the default level
341 // (INFO).
342 if (command_line.HasSwitch(switches::kLoggingLevel) &&
343 logging::GetMinLogLevel() >= 0) {
344 std::string log_level =
345 command_line.GetSwitchValueASCII(switches::kLoggingLevel);
341 int level = 0; 346 int level = 0;
342 if (base::StringToInt(log_level, &level) && 347 if (base::StringToInt(log_level, &level) && level >= 0 &&
343 level >= 0 && level < LOG_NUM_SEVERITIES) { 348 level < LOG_NUM_SEVERITIES) {
344 logging::SetMinLogLevel(level); 349 logging::SetMinLogLevel(level);
345 } else { 350 } else {
346 DLOG(WARNING) << "Bad log level: " << log_level; 351 DLOG(WARNING) << "Bad log level: " << log_level;
347 } 352 }
348 } 353 }
349 354
350 #if defined(OS_WIN) 355 #if defined(OS_WIN)
351 // Enable trace control and transport through event tracing for Windows. 356 // Enable trace control and transport through event tracing for Windows.
352 logging::LogEventProvider::Initialize(kChromeTraceProviderName); 357 logging::LogEventProvider::Initialize(kChromeTraceProviderName);
353 #endif 358 #endif
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 time_deets.year, 404 time_deets.year,
400 time_deets.month, 405 time_deets.month,
401 time_deets.day_of_month, 406 time_deets.day_of_month,
402 time_deets.hour, 407 time_deets.hour,
403 time_deets.minute, 408 time_deets.minute,
404 time_deets.second); 409 time_deets.second);
405 return base_path.InsertBeforeExtensionASCII(suffix); 410 return base_path.InsertBeforeExtensionASCII(suffix);
406 } 411 }
407 412
408 } // namespace logging 413 } // namespace logging
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698