summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 00:34:27 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 00:34:27 +0000
commit41703f7ec3774c1f9766b263ce3e9a93c03c4765 (patch)
tree200b30cb49dd7a54f3bac331c474a52fce2ce91f /base
parenteca3e46dc5fb6ec07d70c1950dd074fc0bfc69c7 (diff)
downloadchromium_src-41703f7ec3774c1f9766b263ce3e9a93c03c4765.zip
chromium_src-41703f7ec3774c1f9766b263ce3e9a93c03c4765.tar.gz
chromium_src-41703f7ec3774c1f9766b263ce3e9a93c03c4765.tar.bz2
Fixed bug where the entire file path was being printed for logs on non-Windows
BUG=None TEST=Manual Review URL: http://codereview.chromium.org/4215003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64345 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/logging.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/base/logging.cc b/base/logging.cc
index e78b1a4..a9ce815 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -533,10 +533,10 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity)
// writes the common header info to the stream
void LogMessage::Init(const char* file, int line) {
- // log only the filename
- const char* last_slash = strrchr(file, '\\');
- if (last_slash)
- file = last_slash + 1;
+ base::StringPiece filename(file);
+ size_t last_slash_pos = filename.find_last_of("\\/");
+ if (last_slash_pos != base::StringPiece::npos)
+ filename.remove_prefix(last_slash_pos + 1);
// TODO(darin): It might be nice if the columns were fixed width.
@@ -565,7 +565,7 @@ void LogMessage::Init(const char* file, int line) {
}
if (log_tickcount)
stream_ << TickCount() << ':';
- stream_ << log_severity_names[severity_] << ":" << file <<
+ stream_ << log_severity_names[severity_] << ":" << filename <<
"(" << line << ")] ";
message_start_ = stream_.tellp();