![]() |
Rosetta
3.7
|
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 Types | |
typedef std::ostream * | OstreamPointer |
![]() | |
typedef platform::Size | Size |
typedef platform::Size | size_type |
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... | |
Tracer (std::string const &channel, std::string const &channel_color, std::string const &channel_name_color="", TracerPriority priority=t_info, bool muted_by_default=false) | |
Create Tracer object with channel color, channel name color and 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 () const |
get/set tracer priority level. More... | |
Tracer & | operator() (int priority) |
void | priority (int priority) |
std::string const & | channel () const |
std::string const & | channel_color () |
Get the channel color. More... | |
void | channel_color (std::string const &color) |
Set the channel color. More... | |
std::string const & | channel_name_color () |
void | channel_name_color (std::string const &color) |
![]() | |
basic_otstream () | |
virtual | ~basic_otstream () |
bool | is_flushed () const |
Return true if inner string buffer is empty. More... | |
![]() | |
ReferenceCount () | |
Default constructor. More... | |
virtual | ~ReferenceCount () |
Static Public Member Functions | |
static OstreamPointer & | final_stream () |
set ios hook for final tracer stream (deafult is std::cout). More... | |
static void | set_new_final_stream (std::ostream *new_final_stream) |
static void | set_default_final_stream () |
static void | set_ios_hook (otstreamOP tr, std::string const &monitoring_channels_list, bool raw=true) |
set ios hook for all tracer io operation. More... | |
static std::string const & | get_all_channels_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 () |
static void | calculate_tracer_visibilities () |
This function should be invoked after the options system has been initialized, so that the visibility for all tracers that have so far been constructed and have been waiting for the options system to be initialized can now have their visibility calculated. After this function completes, all newly-constructed Tracers will calculate their visibility in their constructors. Visibility is no longer be calculated on a just-in-time basis and stored in mutable data members. More... | |
Public Attributes | |
TracerProxy | Fatal |
channels with predefined priority levels. More... | |
TracerProxy | Error |
TracerProxy | Warning |
TracerProxy | Info |
TracerProxy | Debug |
TracerProxy | Trace |
Static Public Attributes | |
static utility::CSI_Sequence | Reset |
static utility::CSI_Sequence | Bold |
static utility::CSI_Sequence | Underline |
static utility::CSI_Sequence | Black |
static utility::CSI_Sequence | Red |
static utility::CSI_Sequence | Green |
static utility::CSI_Sequence | Yellow |
static utility::CSI_Sequence | Blue |
static utility::CSI_Sequence | Magenta |
static utility::CSI_Sequence | Cyan |
static utility::CSI_Sequence | White |
static utility::CSI_Sequence | bgBlack |
static utility::CSI_Sequence | bgRed |
static utility::CSI_Sequence | bgGreen |
static utility::CSI_Sequence | bgYellow |
static utility::CSI_Sequence | bgBlue |
static utility::CSI_Sequence | bgMagenta |
static utility::CSI_Sequence | bgCyan |
static utility::CSI_Sequence | bgWhite |
Protected Member Functions | |
virtual void | t_flush (std::string const &) |
overload member function. More... | |
Private Member Functions | |
void | init (std::string const &channel, std::string const &channel_color, std::string const &channel_name_color, TracerPriority priority, bool muted_by_default) |
init Tracer object with given parameters. This is a helper function to be called from various constructors More... | |
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 () |
calcualte visibility of the current object depending of the channel name and priority. More... | |
bool | visibility_calculated () const |
Adding this function to get around unused class data member warnings; you should never have to worry about whether the visibility for a Tracer has been calculated. 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 | register_tracer (Tracer *tracer) |
Tracers must register themselves with the static array of all tracers so that they can be flushed en masse if need be. This function is thread safe. More... | |
static void | calculate_visibility (std::string const &channel, int priority, bool &visible, bool &muted, int &mute_level_, bool muted_by_default) |
static void | safe_output (std::string const &) |
Output a message in a manner that is safe if the Tracers/output are poorly initialized. More... | |
static otstreamOP & | ios_hook () |
link to Tracer like object where all output for selecting channels should go. More... | |
static bool & | ios_hook_raw_ () |
should the ios_hook_ the raw output? More... | |
static bool & | super_mute_ () |
global super mute flag that allow to mute all io no matter what. More... | |
Private Attributes | |
std::string | channel_ |
Data members. More... | |
std::string | channel_color_ |
default colors for tracer output and tracer channel-name string (ie color of string such as: 'core.pose:') More... | |
std::string | channel_name_color_ |
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 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 | initial_tracers_visibility_calculated_ |
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... | |
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'.
typedef std::ostream* basic::Tracer::OstreamPointer |
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 init().
basic::Tracer::Tracer | ( | std::string const & | channel, |
std::string const & | channel_color, | ||
std::string const & | channel_name_color = "" , |
||
TracerPriority | priority = t_info , |
||
bool | muted_by_default = false |
||
) |
Create Tracer object with channel color, channel name color and given channel and priority.
Ex: static THREAD_LOCAL basic::Tracer Blue("blue", CSI_Blue);
References init().
|
virtual |
|
private |
copy constructor.
Functions
|
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 ObjexxFCL::len(), ObjexxFCL::lowercased(), basic::options::OptionKeys::in::file::s, safe_output(), amino_acids::size, 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().
|
static |
This function should be invoked after the options system has been initialized, so that the visibility for all tracers that have so far been constructed and have been waiting for the options system to be initialized can now have their visibility calculated. After this function completes, all newly-constructed Tracers will calculate their visibility in their constructors. Visibility is no longer be calculated on a just-in-time basis and stored in mutable data members.
References basic::TracerManager::get_instance(), test.T200_Scoring::ii, and initial_tracers_visibility_calculated_.
|
private |
calcualte visibility of the current object depending of the channel name and priority.
Calculate visibility of current Tracer object and all of its proxies
References basic::Tracer::TracerProxy::calculate_visibility(), channel_, Debug, Error, Fatal, Info, mute_level_, muted_, muted_by_default_, priority_, Trace, visibility_calculated_, visible_, and Warning.
Referenced by basic::Tracer::TracerProxy::calculate_visibility(), init(), and basic::T().
|
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 init(), and basic::show_time().
|
inline |
|
inline |
Set the channel color.
This can be done in a stream like this: TR << TR.bgWhite << TR.Black << "Example" << TR.Reset << std::endl;
References channel_color_.
|
inline |
References channel_name_color_.
Referenced by init().
|
inline |
References channel_name_color_.
|
static |
set ios hook for final tracer stream (deafult is std::cout).
References utility::io::oc::cout.
Referenced by safe_output(), set_default_final_stream(), set_new_final_stream(), and t_flush().
void basic::Tracer::flush_all_channels | ( | ) |
|
static |
References basic::TracerManager::get_instance().
|
static |
Referenced by t_flush().
|
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, and amino_acids::size.
Referenced by calculate_visibility(), and t_flush().
|
private |
init Tracer object with given parameters. This is a helper function to be called from various constructors
References basic::TracerManager::all_tracers(), begining_of_the_line_, calculate_visibility(), channel(), channel_, channel_color(), channel_color_, channel_name_color(), channel_name_color_, basic::TracerManager::get_instance(), initial_tracers_visibility_calculated_, mute_level_, muted_, muted_by_default_, priority(), priority_, visibility_calculated_, and visible_.
Referenced by Tracer().
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_, calculate_visibility(), channel_, initial_tracers_visibility_calculated_, mute_level_, muted_, priority_, visibility_calculated_, and visible_.
|
staticprivate |
link to Tracer like object where all output for selecting channels should go.
static data members
Referenced by safe_output(), set_ios_hook(), and t_flush().
|
staticprivate |
should the ios_hook_ the raw output?
References basic::options::OptionKeys::out::file::raw.
Referenced by set_ios_hook(), and t_flush().
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_, channel_color_, channel_name_color_, mpi_rank_, basic::TracerOptions::print_channel_name, Reset, basic::options::OptionKeys::in::file::s, utility::timestamp(), basic::TracerOptions::timestamp, and tracer_options_.
|
inline |
get/set tracer priority level.
References priority_.
Referenced by init(), operator()(), and priority().
void basic::Tracer::priority | ( | int | priority | ) |
References mute_level_, muted_, priority(), priority_, visibility_calculated_, and visible_.
|
staticprivate |
Tracers must register themselves with the static array of all tracers so that they can be flushed en masse if need be. This function is thread safe.
|
staticprivate |
Output a message in a manner that is safe if the Tracers/output are poorly initialized.
References utility::io::oc::cerr, final_stream(), and ios_hook().
Referenced by calculate_tracer_level().
|
static |
References utility::io::oc::cout, and final_stream().
|
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. When raw==false 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 tr().
|
static |
References final_stream().
|
inlinestatic |
global super mute flag that allow to mute all io no matter what.
References super_mute_().
|
inlinestatic |
References demo.D060_Folding::f, and super_mute_().
|
staticprivate |
global super mute flag that allow to mute all io no matter what.
References basic::options::OptionKeys::out::mute.
Referenced by super_mute(), and t_flush().
|
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 channel_, final_stream(), get_all_channels_string(), in(), initial_tracers_visibility_calculated_, 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_.
|
inlineprivate |
Adding this function to get around unused class data member warnings; you should never have to worry about whether the visibility for a Tracer has been calculated.
References visibility_calculated_.
|
inline |
Is this tracer currently visible?.
References visible_.
Referenced by calculate_visibility(), main(), basic::MemTracer::t_flush(), and t_flush().
is this tracer visible, if it used the given priority value?
References mute_level_, and muted_.
|
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).
|
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 |
Referenced by mg_modeler_test(), and swa_rna_sample().
|
static |
|
private |
Data members.
channel name
Referenced by basic::Tracer::TracerProxy::calculate_visibility(), calculate_visibility(), channel(), init(), prepend_channel_name(), basic::T(), and t_flush().
|
private |
default colors for tracer output and tracer channel-name string (ie color of string such as: 'core.pose:')
Referenced by channel_color(), init(), and prepend_channel_name().
|
private |
Referenced by channel_name_color(), init(), and prepend_channel_name().
|
static |
TracerProxy basic::Tracer::Debug |
Referenced by calc_scores(), calculate_visibility(), basic::database::schema_generator::Schema::check_table_and_perform_write(), DockFragmentsMover::cluster_frags(), basic::database::find_cache_file(), flush_all_channels(), basic::mpi::MessageListenerFactory::get_listener(), main(), read_pose(), read_structures(), read_thickness(), basic::mpi::request_data_from_head_node(), ScoreFragmentSetMover::run(), ConsensusFragmentMover::run(), SolutionRescoreMover::run(), basic::database::schema_generator::Schema::write(), and ~Tracer().
TracerProxy basic::Tracer::Error |
Referenced by IAMover::apply(), calculate_visibility(), correlation(), flush_all_channels(), get_out_tag(), UBQ_GTPase_disulfide_Mover::init_on_new_input(), UBQ_GTPaseMover::init_on_new_input(), UBQ_E2Mover::init_on_new_input(), load_loops_from_file(), main(), basic::datacache::WriteableCacheableDataFactory::new_data_instance(), read_in_mutations(), basic::database::safely_prepare_statement(), basic::show_time(), statistics(), validate_dunbrack_binaries(), basic::database::schema_generator::Schema::write(), basic::database::write_schema_to_database(), and ~Tracer().
TracerProxy basic::Tracer::Fatal |
channels with predefined priority levels.
Referenced by calculate_visibility(), check_option_conflicts(), flush_all_channels(), and ~Tracer().
|
static |
TracerProxy basic::Tracer::Info |
Referenced by calculate_visibility(), flush_all_channels(), main(), run(), and ~Tracer().
|
staticprivate |
Referenced by calculate_tracer_visibilities(), init(), basic::Tracer::TracerProxy::t_flush(), 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().
|
private |
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().
|
private |
is channel muted ?
Referenced by calculate_visibility(), init(), priority(), and visible().
|
private |
is channel muted by default?
Referenced by calculate_visibility(), and init().
|
private |
channel output priority level
Referenced by basic::Tracer::TracerProxy::calculate_visibility(), calculate_visibility(), init(), priority(), basic::T(), and basic::Tracer::TracerProxy::t_flush().
|
static |
|
static |
Static objects holding various ASCII CSI codes (see utility/CSI_Sequence.hh)
Referenced by mg_modeler_test(), prepend_channel_name(), and swa_rna_sample().
TracerProxy basic::Tracer::Trace |
|
staticprivate |
global option collection for Tracer IO.
Referenced by calculate_visibility(), prepend_channel_name(), and tracer_options().
|
static |
|
private |
is channel visibility already calculated?
Referenced by basic::Tracer::TracerProxy::calculate_visibility(), calculate_visibility(), init(), priority(), basic::Tracer::TracerProxy::t_flush(), t_flush(), and visibility_calculated().
|
private |
is channel visible?
Referenced by basic::Tracer::TracerProxy::calculate_visibility(), calculate_visibility(), init(), priority(), and visible().
TracerProxy basic::Tracer::Warning |
Referenced by calculate_visibility(), flush_all_channels(), basic::database::get_db_session(), main(), and ~Tracer().
|
static |
|
static |