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

Side by Side Diff: chrome/browser/sync_file_system/logger.cc

Issue 20609006: Add severity info to drive::EventLogger. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase - the 2nd try - Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/drive/event_logger_unittest.cc ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/sync_file_system/logger.h" 5 #include "chrome/browser/sync_file_system/logger.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 va_list args; 48 va_list args;
49 va_start(args, format); 49 va_start(args, format);
50 base::StringAppendV(&what, format, args); 50 base::StringAppendV(&what, format, args);
51 va_end(args); 51 va_end(args);
52 52
53 // Log to WebUI regardless of LogSeverity (e.g. ignores command line flags). 53 // Log to WebUI regardless of LogSeverity (e.g. ignores command line flags).
54 // On thread-safety: LazyInstance guarantees thread-safety for the object 54 // On thread-safety: LazyInstance guarantees thread-safety for the object
55 // creation. EventLogger::Log() internally maintains the lock. 55 // creation. EventLogger::Log() internally maintains the lock.
56 drive::EventLogger* ptr = g_logger.Pointer(); 56 drive::EventLogger* ptr = g_logger.Pointer();
57 ptr->Log("[%s] %s", LogSeverityToString(severity), what.c_str()); 57 ptr->Log(severity, base::StringPrintf("[%s] %s",
58 LogSeverityToString(severity),
59 what.c_str()));
58 60
59 // Log to console if the severity is at or above the min level. 61 // Log to console if the severity is at or above the min level.
60 // LOG_VERBOSE logs are also output if the verbosity of this module 62 // LOG_VERBOSE logs are also output if the verbosity of this module
61 // (sync_file_system/logger) is >= 1. 63 // (sync_file_system/logger) is >= 1.
62 // TODO(kinuko,calvinlo): Reconsider this logging hack, it's not recommended 64 // TODO(kinuko,calvinlo): Reconsider this logging hack, it's not recommended
63 // to directly use LogMessage. 65 // to directly use LogMessage.
64 if (severity < logging::GetMinLogLevel() && !VLOG_IS_ON(1)) 66 if (severity < logging::GetMinLogLevel() && !VLOG_IS_ON(1))
65 return; 67 return;
66 logging::LogMessage(location.file_name(), location.line_number(), severity) 68 logging::LogMessage(location.file_name(), location.line_number(), severity)
67 .stream() << what; 69 .stream() << what;
68 } 70 }
69 71
70 std::vector<drive::EventLogger::Event> GetLogHistory() { 72 std::vector<drive::EventLogger::Event> GetLogHistory() {
71 drive::EventLogger* ptr = g_logger.Pointer(); 73 drive::EventLogger* ptr = g_logger.Pointer();
72 return ptr->GetHistory(); 74 return ptr->GetHistory();
73 } 75 }
74 76
75 } // namespace util 77 } // namespace util
76 } // namespace sync_file_system 78 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/drive/event_logger_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698