Fast DDS  Version 3.1.0
Fast DDS
Loading...
Searching...
No Matches
FileConsumer.hpp
1// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
20#ifndef FASTDDS_DDS_LOG__FILECONSUMER_HPP
21#define FASTDDS_DDS_LOG__FILECONSUMER_HPP
22
23#include <fastdds/dds/log/Log.hpp>
24#include <fastdds/dds/log/OStreamConsumer.hpp>
25
26#include <fstream>
27
28namespace eprosima {
29namespace fastdds {
30namespace dds {
31
38{
39public:
40
42 FASTDDS_EXPORTED_API FileConsumer();
43
48 FASTDDS_EXPORTED_API FileConsumer(
49 const std::string& filename,
50 bool append = false);
51
52 virtual ~FileConsumer();
53
54private:
55
60 FASTDDS_EXPORTED_API virtual std::ostream& get_stream(
61 const Log::Entry& entry) override;
62
63 std::string output_file_;
64 std::ofstream file_;
65 bool append_;
66};
67
68} // namespace dds
69} // namespace fastdds
70} // namespace eprosima
71
72#endif // FASTDDS_DDS_LOG__FILECONSUMER_HPP
Definition FileConsumer.hpp:38
FASTDDS_EXPORTED_API FileConsumer()
Default constructor: filename = "output.log", append = false.
FASTDDS_EXPORTED_API FileConsumer(const std::string &filename, bool append=false)
Constructor with parameters.
Definition OStreamConsumer.hpp:32
Definition DomainParticipant.hpp:45
eProsima namespace.
Definition Log.hpp:174