| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CRASH_REPORTER_SYSTEM_LOGGING_H_ | |
| 6 #define CRASH_REPORTER_SYSTEM_LOGGING_H_ | |
| 7 | |
| 8 #include <stdarg.h> | |
| 9 #include <string> | |
| 10 | |
| 11 class SystemLogging { | |
| 12 public: | |
| 13 virtual void Initialize(const char *ident) = 0; | |
| 14 virtual void LogInfo(const char *format, ...) = 0; | |
| 15 virtual void LogWarning(const char *format, ...) = 0; | |
| 16 virtual void LogError(const char *format, ...) = 0; | |
| 17 virtual void set_accumulating(bool value) = 0; | |
| 18 virtual std::string get_accumulator() = 0; | |
| 19 }; | |
| 20 | |
| 21 // SystemLoggingImpl implements SystemLogging but adds the | |
| 22 // capability of accumulating the log to a STL string. | |
| 23 class SystemLoggingImpl : public SystemLogging { | |
| 24 public: | |
| 25 SystemLoggingImpl(); | |
| 26 virtual ~SystemLoggingImpl(); | |
| 27 virtual void Initialize(const char *ident); | |
| 28 virtual void LogInfo(const char *format, ...); | |
| 29 virtual void LogWarning(const char *format, ...); | |
| 30 virtual void LogError(const char *format, ...); | |
| 31 virtual void set_accumulating(bool value) { | |
| 32 is_accumulating_ = value; | |
| 33 } | |
| 34 virtual std::string get_accumulator() { | |
| 35 return accumulator_; | |
| 36 } | |
| 37 private: | |
| 38 static std::string identity_; | |
| 39 std::string accumulator_; | |
| 40 bool is_accumulating_; | |
| 41 void LogWithLevel(int level, const char *format, | |
| 42 va_list arg_list); | |
| 43 }; | |
| 44 | |
| 45 #endif // CRASH_REPORTER_SYSTEM_LOGGING_H_ | |
| OLD | NEW |