StringTarget.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_Logger_StringTarget_
18 #define HH_SENF_Utils_Logger_StringTarget_ 1
19 
20 // Custom includes
21 #include <sstream>
22 #include "IOStreamTarget.hh"
23 
24 //#include "StringTarget.mpp"
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 namespace log {
29 
37  : private boost::base_from_member<std::stringstream>,
38  public IOStreamTarget
39  {
40  typedef boost::base_from_member<std::stringstream> stream_base;
41  public:
42  //-////////////////////////////////////////////////////////////////////////
43  // Types
44 
45  //-////////////////////////////////////////////////////////////////////////
47  //\{
48 
49  StringTarget();
50 
51  //\}
52  //-////////////////////////////////////////////////////////////////////////
53 
54  std::string str() const;
55  void clear();
56 
57  protected:
58 
59  private:
60 
61  };
62 
63 }}
64 
65 //-/////////////////////////////////////////////////////////////////////////////////////////////////
66 //#include "StringTarget.cci"
67 //#include "StringTarget.ct"
68 #include "StringTarget.cti"
69 #endif
70 
71 
72 // Local Variables:
73 // mode: c++
74 // fill-column: 100
75 // comment-column: 40
76 // c-file-style: "senf"
77 // indent-tabs-mode: nil
78 // ispell-local-dictionary: "american"
79 // compile-command: "scons -u test"
80 // End:
Store log messages in a string buffer.
Definition: StringTarget.hh:36
Write log messages to arbitrary std::ostream.
void clear()
Clear buffer.
std::string str() const
Get log messages accumulated so far.
IOStreamTarget public header.