Class that allows us to centralize all the reporting messages that should be used to inform the user of Errors, Warnings and Info.
The object can also be used as a substitute to cout for temporal messages using the << overloaded operator or the log method, and the messages will be behind the IsDebug variable, which should be set to false in Release.
This allows us to protect the user from receiving Debug/Developing messages that shouldn't bother them, in case any of them is not removed by error.
More...
#include <reportsystem.h>
Public Member Functions | |
void | PrintCodesAndMessages () |
Method to print all Info, Warning and Error codes and their respective message. This method is useful to check whether all codes have a message linked to them. It will use the current VerboseLevel of the object, which defaults to ERROR level. More... | |
void | report (ErrorCode message, std::string *vars=nullptr) |
Method to report an Error. It will be displayed if Level is equal or higher to VerboseLevel::ERROR. More... | |
void | report (ErrorCode message, const char *vars) |
Method to report an Error. It will be displayed if Level is equal or higher to VerboseLevel::ERROR. More... | |
void | report (WarningCode message, std::string *vars=nullptr) |
Method to report a Warning. It will be displayed if Level is equal or higher to VerboseLevel::WARNING. More... | |
void | report (WarningCode message, const char *vars) |
Method to report a Warning. It will be displayed if Level is equal or higher to VerboseLevel::WARNING. More... | |
void | report (InfoCode message, std::string *vars=nullptr) |
Method to report an Info message. It will be displayed if Level is equal or higher to VerboseLevel::INFO. More... | |
void | report (InfoCode message, const char *vars) |
Method to report an Info message. It will be displayed if Level is equal or higher to VerboseLevel::WARNING. More... | |
reportWrapper | log (VerboseLevel level) |
Method to output a message behind two checks: IsDebug and VerboseLevel passed. If IsDebug is false, it will ignore the message returning the cantReport , otherwise, VerboseLevel level will be checked. More... | |
template<typename T > | |
reportManager & | operator<< (const T &a) |
Overloaded operator that allows us to debug some messages behind IsDebug . More... | |
reportManager & | operator<< (std::ostream &(*pf)(std::ostream &)) |
Overloaded operator that allows us to debug some messages behind IsDebug . More... | |
Public Attributes | |
VerboseLevel | Level = VerboseLevel::INFO |
Level of Verbosity. The report system won't output messages that are lower than the current level. More... | |
bool | IsDebug = false |
Protection variable. This variable should be set to true while in development, and false on Release. More... | |
Private Attributes | |
reportWrapper | canReport = reportWrapper(true) |
Object that will be returned by log if it allows to output the message. More... | |
reportWrapper | cantReport = reportWrapper(false) |
Object that will be returned by log if it doesn't allow to output the message. More... | |
Static Private Attributes | |
static const std::map< InfoCode, const char * > | InfoMessages |
static const std::map< WarningCode, const char * > | WarningMessages |
static const std::map< ErrorCode, const char * > | ErrorMessages |
Related Functions | |
(Note that these are not member functions.) | |
reporting::reportManager | debug |
This instance is the one that should be used It's use is similar to a singleton, without the need to obtain the instance every time it's needed. Instead, it's a global instance of the reporting::reportManager This allows us to have the '<<' operator overloaded, as it can't be statically overloaded. More... | |
Class that allows us to centralize all the reporting messages that should be used to inform the user of Errors, Warnings and Info.
The object can also be used as a substitute to cout for temporal messages using the << overloaded operator or the log method, and the messages will be behind the IsDebug variable, which should be set to false in Release.
This allows us to protect the user from receiving Debug/Developing messages that shouldn't bother them, in case any of them is not removed by error.
Definition at line 354 of file reportsystem.h.
|
inline |
Method to output a message behind two checks: IsDebug and VerboseLevel passed.
If IsDebug is false, it will ignore the message returning the cantReport , otherwise, VerboseLevel level will be checked.
level | Level to use for this message. If Level is higher than this argument, message will be ignored, otherwise, message will be outputted to cout. |
Definition at line 494 of file reportsystem.h.
References canReport, cantReport, IsDebug, and Level.
|
inline |
Overloaded operator that allows us to debug some messages behind IsDebug .
a | Message to be outputed if IsDebug |
Definition at line 512 of file reportsystem.h.
References IsDebug.
|
inline |
Overloaded operator that allows us to debug some messages behind IsDebug .
pf | Object that overloads the '<<' operator |
Definition at line 524 of file reportsystem.h.
References IsDebug.
void reporting::reportManager::PrintCodesAndMessages | ( | ) |
Method to print all Info, Warning and Error codes and their respective message.
This method is useful to check whether all codes have a message linked to them. It will use the current VerboseLevel of the object, which defaults to ERROR level.
Definition at line 35 of file reportsystem.cpp.
References __MAXERROR, __MAXINFO, __MAXWARNING, ERROR, INFO, Level, NONE, report(), and WARNING.
void reporting::reportManager::report | ( | ErrorCode | message, |
std::string * | vars = nullptr |
||
) |
Method to report an Error.
It will be displayed if Level is equal or higher to VerboseLevel::ERROR.
message | Code to report. |
vars | Array of strings that will replace the '[tags]' in the message. The number of elements in the array must be the same as [tag] occurrences on the message. The method will take care of destroying the array |
Definition at line 67 of file reportsystem.cpp.
References ERROR, ErrorMessages, and Level.
Referenced by Alignment::alignmentSummaryHTML(), Alignment::alignmentSummarySVG(), statistics::Gaps::applyWindow(), statistics::Mold::applyWindow(), statistics::Consistency::applyWindow(), statistics::Similarity::applyWindow(), trimAlManager::block_argument(), trimAlManager::check_absolute_gap_theshold(), trimAlManager::check_automated_manual_incompatibilities(), trimAlManager::check_automated_methods_incompatibilities(), trimAlManager::check_backtranslations(), trimAlManager::check_block_size(), trimAlManager::check_clusters_incompatibilities(), trimAlManager::check_coding_sequences_type(), trimAlManager::check_codon_behaviour_incompatibility(), trimAlManager::check_col_numbering(), trimAlManager::check_combinations_among_thresholds_incompatibility(), trimAlManager::check_file_aligned(), trimAlManager::check_force_selection(), trimAlManager::check_inFile_incompatibilities(), trimAlManager::check_input_file_with_coding_sequences_argument(), trimAlManager::check_max_identity_incompatibilities(), trimAlManager::check_output_file_with_statistics(), trimAlManager::check_output_relevance(), trimAlManager::check_outputs_coincidence(), trimAlManager::check_residue_and_sequence_overlap(), trimAlManager::check_select_cols_and_seqs_incompatibilities(), trimAlManager::check_similarity_matrix(), trimAlManager::check_stats_incompatibilities(), trimAlManager::check_thresholds_incompatibilities(), trimAlManager::check_windows_incompatibilities(), Alignment::checkCorrespondence(), trimAlManager::CleanResiduesNonAuto(), trimAlManager::clusters_argument(), statistics::Consistency::compareAndChoose(), trimAlManager::conservation_threshold_argument(), trimAlManager::consistency_threshold_argument(), trimAlManager::consistency_window_argument(), trimAlManager::create_or_use_similarity_matrix(), Alignment::fillMatrices(), trimAlManager::force_select_argument(), statistics::Consistency::forceComparison(), trimAlManager::gap_threshold_argument(), trimAlManager::gap_window_argument(), statistics::similarityMatrix::getDistance(), trimAlManager::in_argument(), trimAlManager::max_identity_argument(), trimAlManager::min_coverage_argument(), trimAlManager::min_quality_argument(), trimAlManager::out_format_arguments(), trimAlManager::output_reports(), trimAlManager::parseArguments(), statistics::Consistency::perform(), trimAlManager::performCompareset(), Alignment::prepareCodingSequence(), PrintCodesAndMessages(), Cleaner::removeOnlyTerminal(), trimAlManager::residue_overlap_argument(), FormatHandling::FormatManager::saveAlignments(), trimAlManager::select_cols_argument(), trimAlManager::seqs_select_argument(), trimAlManager::sequence_overlap_argument(), trimAlManager::similarity_threshold_argument(), trimAlManager::similarity_window_argument(), utils::trimLine(), trimAlManager::verbosity_argument(), and trimAlManager::window_argument().
void reporting::reportManager::report | ( | ErrorCode | message, |
const char * | vars | ||
) |
Method to report an Error.
It will be displayed if Level is equal or higher to VerboseLevel::ERROR.
message | Code to report. |
vars | Array of chars that will replace the first occurrence of '[tags]' in the message. The method wont take care of destroying the array This allows to reuse the parameter passed. |
Definition at line 95 of file reportsystem.cpp.
References ERROR, ErrorMessages, and Level.
Referenced by trimAlManager::back_trans_argument(), trimAlManager::check_vcf_incompatibility(), trimAlManager::clean_alignment(), trimAlManager::compareset_argument(), trimAlManager::force_select_argument(), FormatHandling::FormatManager::getFormatFromFile(), FormatHandling::FormatManager::getNonEmptyFile(), FormatHandling::FormatManager::loadAlignment(), trimAlManager::matrix_argument(), trimAlManager::out_format_arguments(), trimAlManager::parseArguments(), trimAlManager::save_alignment(), and FormatHandling::FormatManager::saveAlignments().
void reporting::reportManager::report | ( | WarningCode | message, |
std::string * | vars = nullptr |
||
) |
Method to report a Warning.
It will be displayed if Level is equal or higher to VerboseLevel::WARNING.
message | Code to report. |
vars | Array of strings that will replace the '[tags]' in the message. The number of elements in the array must be the same as [tag] occurrences on the message. The method will take care of destroying the array |
Definition at line 120 of file reportsystem.cpp.
References Level, WARNING, and WarningMessages.
Referenced by Alignment::checkCorrespondence(), PrintCodesAndMessages(), Cleaner::removeAllGapsSeqsAndCols(), and FormatHandling::FormatManager::saveAlignments().
void reporting::reportManager::report | ( | WarningCode | message, |
const char * | vars | ||
) |
Method to report a Warning.
It will be displayed if Level is equal or higher to VerboseLevel::WARNING.
message | Code to report. |
vars | Array of chars that will replace the first occurrence of '[tags]' in the message. The method wont take care of destroying the array This allows to reuse the parameter passed. |
Definition at line 148 of file reportsystem.cpp.
References Level, WARNING, and WarningMessages.
void reporting::reportManager::report | ( | InfoCode | message, |
std::string * | vars = nullptr |
||
) |
Method to report an Info message.
It will be displayed if Level is equal or higher to VerboseLevel::INFO.
message | Code to report. |
vars | Array of strings that will replace the '[tags]' in the message. The number of elements in the array must be the same as [tag] occurrences on the message. The method will take care of destroying the array |
Definition at line 173 of file reportsystem.cpp.
References INFO, InfoMessages, and Level.
Referenced by trimAlManager::check_compareset_window_argument(), Alignment::prepareCodingSequence(), PrintCodesAndMessages(), and Cleaner::removeDuplicates().
void reporting::reportManager::report | ( | InfoCode | message, |
const char * | vars | ||
) |
Method to report an Info message.
It will be displayed if Level is equal or higher to VerboseLevel::WARNING.
message | Code to report. |
vars | Array of chars that will replace the first occurrence of '[tags]' in the message. The method wont take care of destroying the array This allows to reuse the parameter passed. |
Definition at line 201 of file reportsystem.cpp.
References INFO, InfoMessages, and Level.
|
related |
This instance is the one that should be used
It's use is similar to a singleton, without the need to obtain the instance every time it's needed.
Instead, it's a global instance of the reporting::reportManager
This allows us to have the '<<' operator overloaded, as it can't be statically overloaded.
Definition at line 540 of file reportsystem.h.
|
private |
Object that will be returned by log if it allows to output the message.
Definition at line 362 of file reportsystem.h.
Referenced by log().
|
private |
Object that will be returned by log if it doesn't allow to output the message.
Definition at line 367 of file reportsystem.h.
Referenced by log().
|
staticprivate |
Definition at line 371 of file reportsystem.h.
Referenced by report().
|
staticprivate |
Definition at line 369 of file reportsystem.h.
Referenced by report().
bool reporting::reportManager::IsDebug = false |
Protection variable. This variable should be set to true while in development, and false on Release.
Definition at line 382 of file reportsystem.h.
Referenced by log(), main(), and operator<<().
VerboseLevel reporting::reportManager::Level = VerboseLevel::INFO |
Level of Verbosity.
The report system won't output messages that are lower than the current level.
Definition at line 377 of file reportsystem.h.
Referenced by log(), PrintCodesAndMessages(), report(), and trimAlManager::verbosity_argument().
|
staticprivate |
Definition at line 370 of file reportsystem.h.
Referenced by report().