rtc_event_log_output.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef API_RTC_EVENT_LOG_OUTPUT_H_
  11. #define API_RTC_EVENT_LOG_OUTPUT_H_
  12. #include <string>
  13. namespace webrtc {
  14. // NOTE: This class is still under development and may change without notice.
  15. class RtcEventLogOutput {
  16. public:
  17. virtual ~RtcEventLogOutput() = default;
  18. // An output normally starts out active, though that might not always be
  19. // the case (e.g. failed to open a file for writing).
  20. // Once an output has become inactive (e.g. maximum file size reached), it can
  21. // never become active again.
  22. virtual bool IsActive() const = 0;
  23. // Write encoded events to an output. Returns true if the output was
  24. // successfully written in its entirety. Otherwise, no guarantee is given
  25. // about how much data was written, if any. The output sink becomes inactive
  26. // after the first time |false| is returned. Write() may not be called on
  27. // an inactive output sink.
  28. virtual bool Write(const std::string& output) = 0;
  29. // Indicates that buffers should be written to disk if applicable.
  30. virtual void Flush() {}
  31. };
  32. } // namespace webrtc
  33. #endif // API_RTC_EVENT_LOG_OUTPUT_H_