blob: e3c0cf67136e18b39ad53b9846c4ae107700828c [file] [log] [blame]
Sebastian Jansson52de8b02019-01-16 17:25:44 +01001/*
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
20namespace webrtc {
21namespace webrtc_impl {
22class 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
34class 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_