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..428f50deea990ddaa2ab01a5a8f3e3aaef47259c 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,18 @@ 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(message) \ |
+ ::chromeos::network_event_log::AddEntry( \ |
+ std::string(__FILE__) + ":" + ::base::StringPrintf("%d",__LINE__), \ |
pneubeck (no reviews)
2012/12/10 09:33:10
that seems rather fine-grained. maybe better:
modu
stevenjb
2012/12/10 20:46:51
Agreed (although I'd do __FUNC__:__LINE__). I expe
Greg Spencer (Chromium)
2012/12/10 23:54:03
What about if I just combine all of them for the "
|
+ std::string(__func__), \ |
+ message) |
+ |
+#define NET_LOG_WARNING(message) \ |
+ NET_LOG(std::string("WARNING:") + message) |
+#define NET_LOG_ERROR(message) \ |
+ NET_LOG(std::string("ERROR:") + message) |
+ |
} // namespace network_event_log |
} // namespace chromeos |