UnityLogStream.h 658 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include <string>
  3. #include "WebRTCPlugin.h"
  4. namespace unity
  5. {
  6. namespace webrtc
  7. {
  8. class UnityLogStream : public rtc::LogSink
  9. {
  10. public:
  11. UnityLogStream(DelegateDebugLog callback)
  12. : on_log_message(callback)
  13. {
  14. }
  15. // log format can be defined in this interface
  16. void OnLogMessage(const std::string& message) override;
  17. static void AddLogStream(DelegateDebugLog callback, rtc::LoggingSeverity loggingSeverity);
  18. static void RemoveLogStream();
  19. private:
  20. DelegateDebugLog on_log_message;
  21. static std::unique_ptr<UnityLogStream> log_stream;
  22. };
  23. }
  24. }