Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
jafar::debug::DebugStream Class Reference

Debug message stream. More...


Detailed Description

Debug message stream.

The default output stream is std::cerr. In order to send messages to the debugStream, you should use macros JFR_WARNING, JFR_DEBUG, JFR_VDEBUG, JFR_VVDEBUG defined in jafarMacro.hpp.

Definition at line 39 of file jafarDebug.hpp.

#include <jafarDebug.hpp>

List of all members.

Public Types

enum  Level {
  Off = 0, Trace = 1, Warning = 2, Debug = 3,
  VerboseDebug = 4, VeryVerboseDebug = 5
}
 Levels of the debug output. More...

Static Public Member Functions

static void setDefaultLevel (Level level_)
 Set the default debug level.
static void setLevel (std::string const &module_, Level level_)
 set the level for a given module
static void moduleOff (std::string const &module_)
 shortcut for setLevel(module_, DebugStream::Off)
static void moduleWarning (std::string const &module_)
 shortcut for setLevel(module_, DebugStream::Warning)
static void moduleDebug (std::string const &module_)
 shortcut for setLevel(module_, DebugStream::Debug)
static void moduleVerboseDebug (std::string const &module_)
 shortcut for setLevel(module_, DebugStream::VerboseDebug)
static void moduleVeryVerboseDebug (std::string const &module_)
 shortcut for setLevel(module_, DebugStream::VeryVerboseDebug)
static void unsetModule (std::string const &module_)
 unset debug level configuration for module_
static void setOutputFile (std::string const &filename_)
 send the debug stream to filename_.
static void setDefaultStream ()
 send the debug stream to the default stream (std::cerr).
static void setStream (std::ostream &os_)
 send the debug stream to the given stream os_.
static void setup (std::string const &module_, Level level_, bool display_=true)
 Call this method before sending any data to the stream.
static void sendLocation (std::string const &module_, char const *file_, int line_)
 Send the given location to the debug stream.
static DebugStreaminstance ()
 Returns the unique instance of the debug stream.

Private Member Functions

bool isDebugging () const

Static Private Member Functions

static std::ostream & stream ()

Private Attributes

std::ostream * debugStream
 Debug output stream pointer.
std::ofstream fileStream
 file stream used when sending the debug to a file.
bool fsOpen
std::map< std::string, LevelmodulesLevel
Level defaultLevel
 level used when module level is not set.
bool debugging

Friends

class boost::serialization::detail::singleton_wrapper< DebugStream >
DebugStreamoperator<< (DebugStream &debugStream, details::stream_function function)
DebugStreamoperator<< (DebugStream &debugStream, details::iosbase_function function)
DebugStreamendl (DebugStream &debugStream)
template<typename T >
DebugStreamoperator<< (DebugStream &debugStream, T const &value)

Member Enumeration Documentation

Levels of the debug output.

Enumerator:
Off 

nothing

Trace 

trace message for non-jafar exceptions

Warning 

warning message

Debug 

debug message, this is the default level

VerboseDebug 

verbose debug

VeryVerboseDebug 

very verbose debug

Definition at line 44 of file jafarDebug.hpp.


Member Function Documentation

static DebugStream& jafar::debug::DebugStream::instance ( ) [inline, static]

Returns the unique instance of the debug stream.

Warning:
usual developpers do not use it directly.

Definition at line 121 of file jafarDebug.hpp.

Referenced by setDefaultLevel(), setLevel(), setStream(), stream(), and unsetModule().

bool jafar::debug::DebugStream::isDebugging ( ) const [inline, private]
Returns:
the state of the stream.

Definition at line 149 of file jafarDebug.hpp.

static void jafar::debug::DebugStream::sendLocation ( std::string const &  module_,
char const *  file_,
int  line_ 
) [static]

Send the given location to the debug stream.

Format of this location is controlled by the flag JFR_DEBUG_FULL_PATH.

Warning:
usual developpers do not use it directly.
static void jafar::debug::DebugStream::setDefaultLevel ( Level  level_) [inline, static]

Set the default debug level.

This level is used when no level is specified for a given module.

Definition at line 55 of file jafarDebug.hpp.

References defaultLevel, and instance().

static void jafar::debug::DebugStream::setup ( std::string const &  module_,
Level  level_,
bool  display_ = true 
) [static]

Call this method before sending any data to the stream.

Warning:
usual developpers do not use it directly.
static std::ostream& jafar::debug::DebugStream::stream ( ) [inline, static, private]
Returns:
the underlying std::ostream.

Definition at line 152 of file jafarDebug.hpp.

References debugStream, and instance().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:34 for Jafar by doxygen 1.7.6.1
LAAS-CNRS