Rosetta 3.3
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Friends
basic::Tracer Class Reference

Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for all your regular io. Channel argument must be related to the location of the source file. For example if you create Tracer object in src/basic/scoring/myfile.cc, then channel must be something like 'src.basic.scoring.myfile'. More...

#include <Tracer.hh>

Inheritance diagram for basic::Tracer:
Inheritance graph
[legend]
Collaboration diagram for basic::Tracer:
Collaboration graph
[legend]

List of all members.

Classes

class  TracerProxy
 Small inner class acting as a proxy to an object that hold it. More...

Public Member Functions

 Tracer (std::string const &channel="", TracerPriority priority=t_info, bool muted_by_default=false)
 Create Tracer object with given channel and priority.
virtual ~Tracer ()
void init (Tracer const &tr)
 re-init using data from another tracer object.
void flush_all_channels ()
 flush tracer buffer and flush buffers of all sub-channels ie: Fatal, Error, Warning, Info, Debug, Trace
bool visible () const
 Is this tracer currently visible?.
bool visible (int priority) const
 is this tracer visible, if it used the given priority value?
int priority ()
 get/set tracer priority level.
Traceroperator() (int priority)
void priority (int priority)

Static Public Member Functions

static void set_ios_hook (otstreamOP tr, std::string const &monitoring_channels_list)
 set ios hook for all tracer io operation.
static void set_ios_hook (otstreamOP tr, std::string const &monitoring_channels_list, bool raw)
static TracerOptionstracer_options ()
 get/set tracer options - global options for Tracer IO.
static bool super_mute ()
 global super mute flag that allow to mute all io no matter what.
static void super_mute (bool f)

Public Attributes

TracerProxy Fatal
 channels with predefined priority levels.
TracerProxy Error
TracerProxy Warning
TracerProxy Info
TracerProxy Debug
TracerProxy Trace

Static Public Attributes

static std::string const AllChannels

Protected Member Functions

virtual void t_flush (std::string const &)
 overload member function.

Friends

TracerT (std::string const &, TracerPriority)
 T is special function for assign tracer property on the static object.

Detailed Description

Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for all your regular io. Channel argument must be related to the location of the source file. For example if you create Tracer object in src/basic/scoring/myfile.cc, then channel must be something like 'src.basic.scoring.myfile'.


Constructor & Destructor Documentation

basic::Tracer::Tracer ( std::string const &  channel = "",
TracerPriority  priority = t_info,
bool  muted_by_default = false 
)

Create Tracer object with given channel and priority.

Constructor of Tracer object. Since most of the Tracer object will be created as static - they Constuctor will be called before Option system is initialized. So we can't really calculate any vizibility or priority here. Such calculation should be done later, whe first IO operation happend.

Todo:
Default Tracer level should probably be modified to t_info here and in options defn.

References priority().

basic::Tracer::~Tracer ( ) [virtual]

Member Function Documentation

void basic::Tracer::flush_all_channels ( )

flush tracer buffer and flush buffers of all sub-channels ie: Fatal, Error, Warning, Info, Debug, Trace

References Debug, Error, Fatal, color_pdb::i, Info, Trace, and Warning.

Referenced by main().

void basic::Tracer::init ( Tracer const &  tr)

re-init using data from another tracer object.

Tracer & basic::Tracer::operator() ( int  priority)

References priority().

void basic::Tracer::priority ( int  priority)
int basic::Tracer::priority ( ) [inline]

get/set tracer priority level.

Referenced by operator()(), priority(), and Tracer().

void basic::Tracer::set_ios_hook ( otstreamOP  tr,
std::string const &  monitoring_channels_list,
bool  raw 
) [static]

Same as above above but gives the option get only the visible and unmuted tracers. It can be useful to get the raw output for applications like the comparing tracers, where the output should not change with command line parameters. It can be useful to get the non-raw output in applications like using the jd2 with MPI, where the output each job should match the output if it was run on a single processor.

References basic::options::OptionKeys::out::file::raw, utility::split(), and tr.

void basic::Tracer::set_ios_hook ( otstreamOP  tr,
std::string const &  monitoring_channels_list 
) [static]

set ios hook for all tracer io operation.

Parameters:
monitoring_channels_listis space separated list of channels.

Set OStringStream object to which all Tracers output listed in the monitoring_channels_list should be copied. Note this copies the output of channels even if they are invisible or muted.

References utility::split(), and tr.

static bool basic::Tracer::super_mute ( ) [inline, static]

global super mute flag that allow to mute all io no matter what.

static void basic::Tracer::super_mute ( bool  f) [inline, static]
void basic::Tracer::t_flush ( std::string const &  str) [protected, virtual]

overload member function.

Inform Tracer that is contents was modified, and IO is in order.

Reimplemented from basic::basic_otstream< CharT, Traits >.

Reimplemented in basic::MemTracer.

References AllChannels, utility::io::oc::cout, and utility::pointer::owning_ptr< T >::get().

Referenced by basic::MemTracer::t_flush().

static TracerOptions& basic::Tracer::tracer_options ( ) [inline, static]

get/set tracer options - global options for Tracer IO.

bool basic::Tracer::visible ( int  priority) const

is this tracer visible, if it used the given priority value?

References basic::TracerOptions::level.

bool basic::Tracer::visible ( ) const

Is this tracer currently visible?.

Referenced by main(), and basic::MemTracer::t_flush().


Friends And Related Function Documentation

Tracer& T ( std::string const &  ,
TracerPriority   
) [friend]

T is special function for assign tracer property on the static object.

Return reference to static Tracer object (after setting it channel and priority).


Member Data Documentation

std::string const basic::Tracer::AllChannels [static]

Referenced by t_flush().

Referenced by flush_all_channels(), main(), and ~Tracer().

channels with predefined priority levels.

Referenced by flush_all_channels(), and ~Tracer().

Referenced by flush_all_channels(), and ~Tracer().

Referenced by flush_all_channels(), and ~Tracer().


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