Index: chromeos/network/network_event_log.h |
diff --git a/chromeos/network/network_event_log.h b/chromeos/network/network_event_log.h |
index be5a2e45077d9f126fd7d0d11f3ca3dd264fd4b1..293144c5931d3617af074b234ba8f4fb0cecffa3 100644 |
--- a/chromeos/network/network_event_log.h |
+++ b/chromeos/network/network_event_log.h |
@@ -9,6 +9,7 @@ |
#include <string> |
#include "base/basictypes.h" |
+#include "base/stringprintf.h" |
#include "base/time.h" |
#include "chromeos/chromeos_export.h" |
@@ -45,6 +46,19 @@ CHROMEOS_EXPORT void AddEntry(const std::string& module, |
// output the events. If |max_events| > 0, limits how many events are output. |
CHROMEOS_EXPORT std::string GetAsString(StringOrder order, size_t max_events); |
+// Macros to make logging format more consistent. |
+#define NET_LOG(module, message) \ |
+ ::chromeos::network_event_log::AddEntry( \ |
+ module, \ |
+ std::string(__FILE__) + ":" + ::base::StringPrintf("%d",__LINE__) + \ |
+ " (" + std::string(__func__) + ")", \ |
+ message) |
+ |
+#define NET_LOG_WARNING(module, message) \ |
+ NET_LOG(module, std::string("WARNING:") + message) |
+#define NET_LOG_ERROR(module, message) \ |
+ NET_LOG(module, std::string("ERROR:") + message) |
+ |
} // namespace network_event_log |
} // namespace chromeos |