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

Unified Diff: chrome/browser/sync_file_system/logger.h

Issue 15657002: Mirror syncfs log to console and WebUI, with LogSeverity support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync_file_system/logger.h
diff --git a/chrome/browser/sync_file_system/logger.h b/chrome/browser/sync_file_system/logger.h
index 20a223c614a78e633a68dd0224e5fba3ec830b03..13e004734fecccce1969f97ab97f8ff289587985 100644
--- a/chrome/browser/sync_file_system/logger.h
+++ b/chrome/browser/sync_file_system/logger.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "base/location.h"
+#include "base/logging.h"
#include "chrome/browser/google_apis/event_logger.h"
namespace sync_file_system {
@@ -15,9 +17,29 @@ namespace sync_file_system {
// base/logging.h, and breaks DCHECK() and friends.
namespace util {
+// Resets the log.
+void ClearLog();
+
// Logs a message using printf format.
// This function can be called from any thread.
-void Log(const char* format, ...) PRINTF_FORMAT(1, 2);
+void Log(tracked_objects::Location location,
+ logging::LogSeverity level,
+ const char* format,
+ ...)
+ PRINTF_FORMAT(3, 4);
+
+// Macros to keep the file and line location of the original Log calls.
+// Unfortunately the second version with no args seems to be needed to keep the
+// compiler happy.
+#define SYNCFS_LOG_WITH_ARGS(severity, format, ...) \
+ sync_file_system::util::Log( \
+ FROM_HERE, logging::LOG_##severity, format, __VA_ARGS__);
+#define SYNCFS_LOG_WITH_NO_ARGS(severity, message) \
+ sync_file_system::util::Log(FROM_HERE, logging::LOG_##severity, message);
+#define GET_SYNCFS_LOG(_1,_2,_3,NAME,...) NAME
+#define SYNCFS_LOG(...) \
+ GET_SYNCFS_LOG(__VA_ARGS__, SYNCFS_LOG_WITH_ARGS, SYNCFS_LOG_WITH_NO_ARGS) \
+ (__VA_ARGS__)
tzik 2013/05/24 04:08:32 Could you avoid using macros in other than simples
calvinlo 2013/05/24 05:12:43 Ok, I did a little bit more research on MARCROs an
// Returns the log history.
// This function can be called from any thread.

Powered by Google App Engine
This is Rietveld 408576698