![]() |
Rosetta Utilities
2014.16.56682
|
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>
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. More... | |
| virtual | ~Tracer () |
| void | init (Tracer const &tr) |
| re-init using data from another tracer object. More... | |
| void | flush_all_channels () |
| flush tracer buffer and flush buffers of all sub-channels ie: Fatal, Error, Warning, Info, Debug, Trace More... | |
| bool | visible () const |
| Is this tracer currently visible?. More... | |
| bool | visible (int priority) const |
| is this tracer visible, if it used the given priority value? More... | |
| int | priority () |
| get/set tracer priority level. More... | |
| Tracer & | operator() (int priority) |
| void | priority (int priority) |
| std::string const & | channel () |
Public Member Functions inherited from basic::basic_otstream< CharT, Traits > | |
| basic_otstream () | |
| virtual | ~basic_otstream () |
| bool | is_flushed () const |
| Return true if inner string buffer is empty. More... | |
Public Member Functions inherited from utility::pointer::ReferenceCount | |
| void | ctor () |
| virtual | ~ReferenceCount () |
| Destructor. More... | |
| Size | ref_count () const |
| Reference count. More... | |
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. More... | |
| static void | set_ios_hook (otstreamOP tr, std::string const &monitoring_channels_list, bool raw) |
| static std::string const | get_AllChannels_string () |
| static TracerOptions & | tracer_options () |
| get/set tracer options - global options for Tracer IO. More... | |
| static bool | super_mute () |
| global super mute flag that allow to mute all io no matter what. More... | |
| static void | super_mute (bool f) |
| static void | flush_all_tracers () |
Public Attributes | |
| TracerProxy | Fatal |
| channels with predefined priority levels. More... | |
| TracerProxy | Error |
| TracerProxy | Warning |
| TracerProxy | Info |
| TracerProxy | Debug |
| TracerProxy | Trace |
Static Public Attributes | |
| static std::string const | AllChannels |
| static CSI_Sequence | Reset |
| pre-created objects to hold various ASCII CSI codes, treat them as almost-const's Codes below is all Hogwarts-approved magic numbers, so do not modify them. For reference see: http://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes More... | |
| static CSI_Sequence | Bold |
| static CSI_Sequence | Underline |
| static CSI_Sequence | Black |
| static CSI_Sequence | Red |
| static CSI_Sequence | Green |
| static CSI_Sequence | Yellow |
| static CSI_Sequence | Blue |
| static CSI_Sequence | Magenta |
| static CSI_Sequence | Cyan |
| static CSI_Sequence | White |
| static CSI_Sequence | bgBlack |
| static CSI_Sequence | bgRed |
| static CSI_Sequence | bgGreen |
| static CSI_Sequence | bgYellow |
| static CSI_Sequence | bgBlue |
| static CSI_Sequence | bgMagenta |
| static CSI_Sequence | bgCyan |
| static CSI_Sequence | bgWhite |
Protected Member Functions | |
| virtual void | t_flush (std::string const &) |
| overload member function. More... | |
Protected Member Functions inherited from utility::pointer::ReferenceCount | |
| ReferenceCount () | |
| Default constructor. More... | |
| ReferenceCount (ReferenceCount const &) | |
| Copy constructor. More... | |
| ReferenceCount & | operator= (ReferenceCount const &) |
| Copy assignment. More... | |
Private Member Functions | |
| Tracer (Tracer const &tr) | |
| copy constructor. More... | |
| template<class out_stream > | |
| void | prepend_channel_name (out_stream &sout, std::string const &str) |
| void | calculate_visibility (void) const |
| calcualte visibility of the current object depending of the channel name and priority. More... | |
Static Private Member Functions | |
| static bool | in (utility::vector1< std::string > const &, std::string const channel, bool strict) |
| return true if channel is inside vector, some logic apply. More... | |
| static bool | calculate_tracer_level (utility::vector1< std::string > const &v, std::string const ch, bool strict, int &res) |
| calculate channel priority with hierarchy in mind. More... | |
| static void | calculate_visibility (std::string const &channel, int priority, bool &visible, bool &muted, int &mute_level_, bool muted_by_default) |
| static std::vector< Tracer * > & | all_tracers () |
| static collection of all Tracer objects More... | |
Private Attributes | |
| std::string | channel_ |
| Data members. More... | |
| int | priority_ |
| channel output priority level More... | |
| int | mute_level_ |
| channel muted priority level (above which level is channel muted), calculated using user suppied -level and -levels options More... | |
| bool | visible_ |
| is channel visible? More... | |
| bool | muted_ |
| is channel muted ? More... | |
| bool | muted_by_default_ |
| is channel muted by default? More... | |
| bool | begining_of_the_line_ |
| is current printing position a begining of the line? More... | |
| bool | visibility_calculated_ |
| is channel visibility already calculated? More... | |
Static Private Attributes | |
| static otstreamOP | ios_hook_ |
| system priority level More... | |
| static bool | ios_hook_raw_ |
| should the ios_hook_ the raw output? More... | |
| static utility::vector1 < std::string > | monitoring_list_ |
| list of channels for which outout should be redirected. More... | |
| static TracerOptions | tracer_options_ |
| global option collection for Tracer IO. More... | |
| static bool | super_mute_ |
| global super mute flag that allow to mute all io no matter what. More... | |
| static int | mpi_rank_ |
| Mpi rank is this process More... | |
Friends | |
| Tracer & | T (std::string const &, TracerPriority) |
| T is special function for assign tracer property on the static object. More... | |
Additional Inherited Members | |
Public Types inherited from utility::pointer::ReferenceCount | |
| typedef platform::Size | Size |
| typedef platform::Size | size_type |
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'.
| 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.
References all_tracers(), channel(), channel_, priority(), and priority_.
|
virtual |
|
private |
copy constructor.
Functions
|
staticprivate |
static collection of all Tracer objects
static collection of all Tracer objects
Referenced by flush_all_tracers(), Tracer(), and ~Tracer().
|
staticprivate |
calculate channel priority with hierarchy in mind.
Same as before but return integer value for matched channel or closest match (we asume that 'v' in levels format, ie like: <channel name>="">:level )
References basic::final_channel, ios_hook_, basic::options::OptionKeys::in::file::s, utility::string2int(), utility::string_split(), basic::t_debug, basic::t_error, basic::t_fatal, basic::t_info, basic::t_trace, and basic::t_warning.
Referenced by calculate_visibility().
|
private |
calcualte visibility of the current object depending of the channel name and priority.
Calculate visibility of current Tracer object.
References channel_, mute_level_, muted_, muted_by_default_, priority_, visibility_calculated_, and visible_.
Referenced by basic::T(), t_flush(), visible(), and basic::Tracer::TracerProxy::visible().
|
staticprivate |
Calculate visibility (static version) of current Tracer object using channel name and priority. result stored in 'muted' and 'visible'.
References calculate_tracer_level(), in(), basic::TracerOptions::level, basic::TracerOptions::levels, utility::mpi_nprocs(), utility::mpi_rank(), mpi_rank_, basic::TracerOptions::muted, tracer_options_, basic::TracerOptions::unmuted, and visible().
|
inline |
References channel_.
Referenced by basic::show_time(), and Tracer().
| void basic::Tracer::flush_all_channels | ( | ) |
|
static |
References all_tracers(), and basic::options::OptionKeys::begin.
|
inlinestatic |
References AllChannels.
|
staticprivate |
return true if channel is inside vector, some logic apply.
Check if string representing channel 'ch' is in vector<string> v. Return true if channel is in vector, false otherwise. Two mode of operation: Strict: strict==true - channels compared verbatim. Regular: strict==false - comparing with hierarchy in mind, ie: ch='basic.pose' v[0]='basic' –> will yield true.
References basic::options::OptionKeys::in::file::s.
Referenced by calculate_visibility(), and t_flush().
| void basic::Tracer::init | ( | Tracer const & | tr | ) |
re-init using data from another tracer object.
re-init using data from another tracer object.
References begining_of_the_line_, channel_, mute_level_, muted_, priority_, visibility_calculated_, and visible_.
References priority().
|
private |
Write the contents of str to sout prepending the channel name on each line if the print_channel_name flag is set.
References begining_of_the_line_, channel_, mpi_rank_, basic::TracerOptions::print_channel_name, basic::options::OptionKeys::in::file::s, utility::timestamp(), basic::TracerOptions::timestamp, and tracer_options_.
|
inline |
get/set tracer priority level.
References priority_.
Referenced by operator()(), priority(), and Tracer().
| void basic::Tracer::priority | ( | int | priority | ) |
References mute_level_, muted_, priority(), priority_, visibility_calculated_, and visible_.
|
static |
set ios hook for all tracer io operation.
| monitoring_channels_list | is 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 ios_hook_, ios_hook_raw_, monitoring_list_, utility::split(), and basic::datacache::tr.
|
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 ios_hook_, ios_hook_raw_, monitoring_list_, basic::options::OptionKeys::out::file::raw, utility::split(), and basic::datacache::tr.
|
inlinestatic |
global super mute flag that allow to mute all io no matter what.
References super_mute_.
|
inlinestatic |
References super_mute_.
|
protectedvirtual |
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, calculate_visibility(), channel_, basic::final_channel, utility::pointer::owning_ptr< T >::get(), in(), ios_hook_, ios_hook_raw_, monitoring_list_, super_mute_, visibility_calculated_, and visible().
Referenced by basic::MemTracer::t_flush().
|
inlinestatic |
get/set tracer options - global options for Tracer IO.
References tracer_options_.
| bool basic::Tracer::visible | ( | ) | const |
Is this tracer currently visible?.
References calculate_visibility(), visibility_calculated_, and visible_.
Referenced by calculate_visibility(), basic::MemTracer::t_flush(), and t_flush().
is this tracer visible, if it used the given priority value?
References calculate_visibility(), mute_level_, muted_, and visibility_calculated_.
|
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).
|
static |
Referenced by get_AllChannels_string(), and t_flush().
|
private |
is current printing position a begining of the line?
Referenced by init(), prepend_channel_name(), and basic::T().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
private |
Data members.
channel name
Referenced by calculate_visibility(), channel(), init(), prepend_channel_name(), basic::T(), t_flush(), and Tracer().
|
static |
| TracerProxy basic::Tracer::Debug |
Referenced by basic::database::schema_generator::Schema::check_table_and_perform_write(), flush_all_channels(), basic::message_listening::MessageListenerFactory::get_listener(), basic::message_listening::request_data_from_head_node(), basic::database::schema_generator::Schema::write(), and ~Tracer().
| TracerProxy basic::Tracer::Error |
| TracerProxy basic::Tracer::Fatal |
channels with predefined priority levels.
Referenced by flush_all_channels(), and ~Tracer().
|
static |
| TracerProxy basic::Tracer::Info |
Referenced by flush_all_channels(), and ~Tracer().
|
staticprivate |
system priority level
static data members link to Tracer like object where all output for selecting channels should go.
Referenced by calculate_tracer_level(), set_ios_hook(), and t_flush().
|
staticprivate |
should the ios_hook_ the raw output?
Referenced by set_ios_hook(), and t_flush().
|
static |
|
staticprivate |
list of channels for which outout should be redirected.
Referenced by set_ios_hook(), and t_flush().
|
staticprivate |
Mpi rank is this process
Referenced by calculate_visibility(), and prepend_channel_name().
|
mutableprivate |
channel muted priority level (above which level is channel muted), calculated using user suppied -level and -levels options
Referenced by calculate_visibility(), init(), priority(), and visible().
|
mutableprivate |
is channel muted ?
Referenced by calculate_visibility(), init(), priority(), and visible().
|
private |
is channel muted by default?
Referenced by calculate_visibility(), and basic::Tracer::TracerProxy::visible().
|
private |
channel output priority level
Referenced by calculate_visibility(), init(), priority(), basic::T(), basic::Tracer::TracerProxy::t_flush(), and Tracer().
|
static |
|
static |
pre-created objects to hold various ASCII CSI codes, treat them as almost-const's Codes below is all Hogwarts-approved magic numbers, so do not modify them. For reference see: http://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes
Static objects to hold various ASCII CSI codes, treat them as almost-const's Codes below is all Hogwarts-approved magic numbers, so do not modify them. For reference see: http://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes
|
staticprivate |
global super mute flag that allow to mute all io no matter what.
Referenced by super_mute(), and t_flush().
| TracerProxy basic::Tracer::Trace |
|
staticprivate |
global option collection for Tracer IO.
Referenced by calculate_visibility(), prepend_channel_name(), and tracer_options().
|
static |
|
mutableprivate |
is channel visibility already calculated?
Referenced by calculate_visibility(), init(), priority(), t_flush(), and visible().
|
mutableprivate |
is channel visible?
Referenced by calculate_visibility(), init(), priority(), and visible().
| TracerProxy basic::Tracer::Warning |
Referenced by flush_all_channels(), basic::database::get_db_session(), basic::options::process(), and ~Tracer().
|
static |
|
static |
1.8.7