Index: system_logging.h |
diff --git a/system_logging.h b/system_logging.h |
index 7ebfc5e5934c3f6e90910a15cd88b11e9399be7f..d1f72a56e6f51d06f62ed4ab70e8b7b32d0380c4 100644 |
--- a/system_logging.h |
+++ b/system_logging.h |
@@ -5,6 +5,7 @@ |
#ifndef CRASH_REPORTER_SYSTEM_LOGGING_H_ |
#define CRASH_REPORTER_SYSTEM_LOGGING_H_ |
+#include <stdarg.h> |
#include <string> |
class SystemLogging { |
@@ -13,8 +14,12 @@ class SystemLogging { |
virtual void LogInfo(const char *format, ...) = 0; |
virtual void LogWarning(const char *format, ...) = 0; |
virtual void LogError(const char *format, ...) = 0; |
+ virtual void set_accumulating(bool value) = 0; |
+ virtual std::string get_accumulator() = 0; |
}; |
+// SystemLoggingImpl implements SystemLogging but adds the |
+// capability of accumulating the log to a STL string. |
class SystemLoggingImpl : public SystemLogging { |
public: |
SystemLoggingImpl(); |
@@ -23,8 +28,18 @@ class SystemLoggingImpl : public SystemLogging { |
virtual void LogInfo(const char *format, ...); |
virtual void LogWarning(const char *format, ...); |
virtual void LogError(const char *format, ...); |
+ virtual void set_accumulating(bool value) { |
+ is_accumulating_ = value; |
+ } |
+ virtual std::string get_accumulator() { |
+ return accumulator_; |
+ } |
private: |
static std::string identity_; |
+ std::string accumulator_; |
+ bool is_accumulating_; |
+ void LogWithLevel(int level, const char *format, |
+ va_list arg_list); |
}; |
#endif // CRASH_REPORTER_SYSTEM_LOGGING_H_ |