• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2019 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 TEST_LOGGING_FILE_LOG_WRITER_H_
11 #define TEST_LOGGING_FILE_LOG_WRITER_H_
12 
13 #include <cstdio>
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 #include "test/logging/log_writer.h"
19 
20 namespace webrtc {
21 namespace webrtc_impl {
22 class FileLogWriter final : public RtcEventLogOutput {
23  public:
24   explicit FileLogWriter(std::string file_path);
25   ~FileLogWriter() final;
26   bool IsActive() const override;
27   bool Write(const std::string& value) override;
28   void Flush() override;
29 
30  private:
31   std::FILE* const out_;
32 };
33 }  // namespace webrtc_impl
34 class FileLogWriterFactory final : public LogWriterFactoryInterface {
35  public:
36   explicit FileLogWriterFactory(std::string base_path);
37   ~FileLogWriterFactory() final;
38 
39   std::unique_ptr<RtcEventLogOutput> Create(std::string filename) override;
40 
41  private:
42   const std::string base_path_;
43   std::vector<std::unique_ptr<webrtc_impl::FileLogWriter>> writers_;
44 };
45 
46 }  // namespace webrtc
47 
48 #endif  // TEST_LOGGING_FILE_LOG_WRITER_H_
49