IFEM  90A354
Public Types | Public Member Functions | Protected Attributes | List of all members
utl::LogStream Class Reference

Logging stream class. More...

#include <LogStream.h>

Collaboration diagram for utl::LogStream:
Collaboration graph
[legend]

Public Types

typedef std::basic_ostream< char, std::char_traits< char > > CoutType
 This is the type of std::cout.
 
typedef CoutType &(* StandardEndLine) (CoutType &)
 Function pointer type.
 

Public Member Functions

 LogStream (std::ostream *out)
 Default constructor. More...
 
 LogStream (std::ostream &out, int ppid=0, int mypid=0)
 Constructor initializing the output stream from a reference. More...
 
void setNull ()
 Nullifies the output stream.
 
void setStream (std::ostream &out)
 Sets the output stream.
 
void setPIDs (int ppid, int mypid)
 Sets PIDs for the stream.
 
void addExtraLog (std::ostream *extra, bool clear=false)
 Adds an extra logging stream.
 
void addExtraLog (std::shared_ptr< std::ostream > extra, bool clear=false)
 Adds an extra logging stream.
 
void removeExtraLog (std::shared_ptr< std::ostream > extra)
 Drop an extra logging stream.
 
template<typename T >
LogStreamoperator<< (const T &data)
 Write data to stream.
 
template<typename T >
LogStreamwrite (const T &data)
 Write data to stream.
 
int precision (int streamsize)
 Set precision of output.
 
int precision () const
 Get current precision.
 
bool good () const
 Check state of stream.
 
void flush ()
 Flush streams.
 
std::ios_base::fmtflags flags () const
 Obtain stream flags.
 
std::ios_base::fmtflags flags (std::ios_base::fmtflags fmtfl)
 Set stream flags.
 
LogStreamoperator= (const LogStream &)
 Assignment operator.
 
LogStreamoperator<< (StandardEndLine manip)
 Handling of the std::endl manipulator with friends.
 

Protected Attributes

std::ostream * m_out
 Main output stream.
 
std::vector< std::shared_ptr< std::ostream > > m_extra
 Extra output streams.
 
int m_ppid
 PID to print on.
 
int m_pid
 This process' PID.
 

Detailed Description

Logging stream class.

Constructor & Destructor Documentation

◆ LogStream() [1/2]

utl::LogStream::LogStream ( std::ostream *  out)
inlineexplicit

Default constructor.

Parameters
outThe output stream to wrap

References m_pid, and m_ppid.

◆ LogStream() [2/2]

utl::LogStream::LogStream ( std::ostream &  out,
int  ppid = 0,
int  mypid = 0 
)
explicit

Constructor initializing the output stream from a reference.

Parameters
outThe output stream to wrap
ppidThe PID to print on
mypidThe PID of this process

The documentation for this class was generated from the following files: