in_memory_log_handler.h 979 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2018 The Chromium 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. #ifndef REMOTING_CLIENT_IN_MEMORY_LOG_HANDLER_H_
  5. #define REMOTING_CLIENT_IN_MEMORY_LOG_HANDLER_H_
  6. #include <string>
  7. namespace remoting {
  8. // Class for capturing logs in memory before printing out.
  9. class InMemoryLogHandler {
  10. public:
  11. InMemoryLogHandler() = delete;
  12. InMemoryLogHandler(const InMemoryLogHandler&) = delete;
  13. InMemoryLogHandler& operator=(const InMemoryLogHandler&) = delete;
  14. // Registers the log handler. This is not thread safe and should be called
  15. // exactly once in the main function.
  16. static void Register();
  17. // Returns most recently captured logs (#lines <= kMaxNumberOfLogs) since the
  18. // app is launched. This must be called after Register() is called.
  19. static std::string GetInMemoryLogs();
  20. };
  21. } // namespace remoting
  22. #endif // REMOTING_CLIENT_IN_MEMORY_LOG_HANDLER_H_