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

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

Issue 4079: Porting refactoring changes:... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 2 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <windows.h> 5 #include <windows.h>
6 6
7 #include <iostream> 7 #include <iostream>
8 #include <fstream> 8 #include <fstream>
9 9
10 #include "chrome/common/logging_chrome.h" 10 #include "chrome/common/logging_chrome.h"
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/sys_info.h"
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/env_util.h"
20 #include "chrome/common/env_vars.h" 20 #include "chrome/common/env_vars.h"
21 21
22 // When true, this means that error dialogs should not be shown. 22 // When true, this means that error dialogs should not be shown.
23 static bool dialogs_are_suppressed_ = false; 23 static bool dialogs_are_suppressed_ = false;
24 24
25 // This should be true for exactly the period between the end of 25 // This should be true for exactly the period between the end of
26 // InitChromeLogging() and the beginning of CleanupChromeLogging(). 26 // InitChromeLogging() and the beginning of CleanupChromeLogging().
27 static bool chrome_logging_initialized_ = false; 27 static bool chrome_logging_initialized_ = false;
28 28
29 // Assertion handler for logging errors that occur when dialogs are 29 // Assertion handler for logging errors that occur when dialogs are
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 logging::LOCK_LOG_FILE, 89 logging::LOCK_LOG_FILE,
90 delete_old_log_file); 90 delete_old_log_file);
91 91
92 // we want process and thread IDs because we have a lot of things running 92 // we want process and thread IDs because we have a lot of things running
93 logging::SetLogItems(true, true, false, true); 93 logging::SetLogItems(true, true, false, true);
94 94
95 // We call running in unattended mode "headless", and allow 95 // We call running in unattended mode "headless", and allow
96 // headless mode to be configured either by the Environment 96 // headless mode to be configured either by the Environment
97 // Variable or by the Command Line Switch. This is for 97 // Variable or by the Command Line Switch. This is for
98 // automated test purposes. 98 // automated test purposes.
99 if (env_util::HasEnvironmentVariable(env_vars::kHeadless) || 99 if (base::SysInfo::HasEnvironmentVariable(env_vars::kHeadless) ||
100 command_line.HasSwitch(switches::kNoErrorDialogs)) 100 command_line.HasSwitch(switches::kNoErrorDialogs))
101 SuppressDialogs(); 101 SuppressDialogs();
102 102
103 std::wstring log_filter_prefix = 103 std::wstring log_filter_prefix =
104 command_line.GetSwitchValue(switches::kLogFilterPrefix); 104 command_line.GetSwitchValue(switches::kLogFilterPrefix);
105 logging::SetLogFilterPrefix(WideToUTF8(log_filter_prefix).c_str()); 105 logging::SetLogFilterPrefix(WideToUTF8(log_filter_prefix).c_str());
106 106
107 // Use a minimum log level if the command line has one, otherwise set the 107 // Use a minimum log level if the command line has one, otherwise set the
108 // default to LOG_WARNING. 108 // default to LOG_WARNING.
109 std::wstring log_level = command_line.GetSwitchValue(switches::kLoggingLevel); 109 std::wstring log_level = command_line.GetSwitchValue(switches::kLoggingLevel);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ++assertion_count; 175 ++assertion_count;
176 } 176 }
177 } 177 }
178 log_file.close(); 178 log_file.close();
179 179
180 return assertion_count; 180 return assertion_count;
181 } 181 }
182 182
183 } // namespace logging 183 } // namespace logging
184 184
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698