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

Unified Diff: chrome/common/logging_chrome.cc

Issue 164352: Reliability test porting: stringy stuff.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: more comments Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/logging_chrome.h ('k') | chrome/common/logging_chrome_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/logging_chrome.cc
===================================================================
--- chrome/common/logging_chrome.cc (revision 23003)
+++ chrome/common/logging_chrome.cc (working copy)
@@ -16,6 +16,7 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/debug_util.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -114,13 +115,7 @@
log_mode = logging::LOG_NONE;
}
-#if defined(OS_POSIX)
- std::string log_file_name = WideToUTF8(GetLogFileName());
-#elif defined(OS_WIN)
- std::wstring log_file_name = GetLogFileName();
-#endif
-
- logging::InitLogging(log_file_name.c_str(),
+ logging::InitLogging(GetLogFileName().value().c_str(),
log_mode,
logging::LOCK_LOG_FILE,
delete_old_log_file);
@@ -165,16 +160,16 @@
chrome_logging_initialized_ = false;
}
-std::wstring GetLogFileName() {
+FilePath GetLogFileName() {
std::wstring filename = base::SysInfo::GetEnvVar(env_vars::kLogFileName);
- if (filename != L"")
- return filename;
+ if (!filename.empty())
+ return FilePath::FromWStringHack(filename);
- const std::wstring log_filename(L"chrome_debug.log");
- std::wstring log_path;
+ const FilePath log_filename(FILE_PATH_LITERAL("chrome_debug.log"));
+ FilePath log_path;
if (PathService::Get(chrome::DIR_LOGS, &log_path)) {
- file_util::AppendToPath(&log_path, log_filename);
+ log_path = log_path.Append(log_filename);
return log_path;
} else {
// error with path service, just use some default file somewhere
@@ -194,11 +189,7 @@
size_t assertion_count = 0;
std::ifstream log_file;
-#if defined(OS_WIN)
- log_file.open(GetLogFileName().c_str());
-#elif defined(OS_POSIX)
- log_file.open(WideToUTF8(GetLogFileName()).c_str());
-#endif
+ log_file.open(GetLogFileName().value().c_str());
if (!log_file.is_open())
return 0;
« no previous file with comments | « chrome/common/logging_chrome.h ('k') | chrome/common/logging_chrome_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698