IOStreamTarget.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_IOStreamTarget_
18 #define HH_SENF_Utils_Logger_IOStreamTarget_ 1
19 
20 // Custom includes
21 #include "Target.hh"
22 #include "LogFormat.hh"
23 
24 //#include "IOStreamTarget.mpp"
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 namespace log {
29 
42  : public Target, private detail::LogFormat
43  {
44  public:
45  //-////////////////////////////////////////////////////////////////////////
47  //\{
48 
49  IOStreamTarget(std::string const & name, std::ostream & os);
50 
51  //\}
52  //-////////////////////////////////////////////////////////////////////////
53 
60 
61  std::ostream & stream() const;
62  void stream(std::ostream & newos);
63 
64  protected:
65  void v_write(time_type timestamp, std::string const & stream,
66  std::string const & area, unsigned level,
67  std::string const & message);
68 
69  private:
70  std::ostream * stream_;
71  };
72 
73 }}
74 
75 //-/////////////////////////////////////////////////////////////////////////////////////////////////
76 #include "IOStreamTarget.cci"
77 //#include "IOStreamTarget.ct"
78 //#include "IOStreamTarget.cti"
79 #endif
80 
81 
82 // Local Variables:
83 // mode: c++
84 // fill-column: 100
85 // comment-column: 40
86 // c-file-style: "senf"
87 // indent-tabs-mode: nil
88 // ispell-local-dictionary: "american"
89 // compile-command: "scons -u test"
90 // End:
void showStream(bool flag=true)
Enable or disable output of stream field.
void showLevel(bool flag=true)
Enable or disable output of log level.
std::ostream & stream() const
void timeFormat(std::string const &format)
Set time format.
Definition: LogFormat.cc:94
void v_write(time_type timestamp, std::string const &stream, std::string const &area, unsigned level, std::string const &message)
Called to write out the routing message.
Write log messages to arbitrary std::ostream.
void showTime(bool flag=true)
Enable or disable output of time field.
LogFormat public header.
IOStreamTarget(std::string const &name, std::ostream &os)
void showArea(bool flag=true)
Enable or disable output of log area.
unspecified_keyword_type name
config::time_type time_type
Definition: TimeSource.hh:31
void tag(std::string const &tag)
Set tag (log line prefix)
Logging target base class.
Definition: Target.hh:133
Target public header.