diff --git a/modules/conop/src/chemdict_tool.cc b/modules/conop/src/chemdict_tool.cc index 4b040f1d23aa5cec5f684f31f968d0ae60e0ddff..28e0a2d703d1918e873ac4ca9095c24d801ff132 100644 --- a/modules/conop/src/chemdict_tool.cc +++ b/modules/conop/src/chemdict_tool.cc @@ -30,6 +30,7 @@ #include <ost/io/mol/chemdict_parser.hh> +#include <ost/log.hh> using namespace ost; @@ -43,6 +44,7 @@ void PrintUsage() std::cout << "supported options are:" << std::endl; std::cout << " -i - ignore compounds reserved by the PDB (01-99, DRG, INH, LIG)" << std::endl; std::cout << " -o - ignore obsolete compounds" << std::endl; + std::cout << " -v - be more verbose" << std::endl; } int main(int argc, char const *argv[]) @@ -51,6 +53,7 @@ int main(int argc, char const *argv[]) PrintUsage(); return 0; } + Logger::Instance().PushVerbosityLevel(1); conop::Compound::Dialect dialect=conop::Compound::PDB; bool ignore_reserved=false; bool ignore_obsolete=false; @@ -69,6 +72,8 @@ int main(int argc, char const *argv[]) ignore_reserved=true; } else if (param=="-o") { ignore_obsolete=true; + } else if (param=="-v") { + Logger::Instance().PushVerbosityLevel(4); } else { PrintUsage(); return 0; diff --git a/modules/io/src/mol/chemdict_parser.cc b/modules/io/src/mol/chemdict_parser.cc index cf997f5b6b9e8f72149deb2f6d818f70b62e0d8c..cf47edb6fe500a82dda179acef119689ccef074e 100644 --- a/modules/io/src/mol/chemdict_parser.cc +++ b/modules/io/src/mol/chemdict_parser.cc @@ -1,4 +1,5 @@ #include <ost/io/mol/chemdict_parser.hh> +#include <ost/log.hh> namespace ost { namespace io { @@ -75,9 +76,9 @@ void ChemdictParser::OnDataRow(const StarLoopDesc& header, if (columns[indices_[DESC_TYPE]] == StringRef("InChI", 5)) { // for type InChi check prefix 'InChI=' if (columns[indices_[DESC]].substr(0, 6) != StringRef("InChI=", 6)) { - std::cout << "InChI problem: compound " << compound_->GetID() - << " has an InChI descriptor not starting with the " - "'InChI=' prefix." << std::endl; + LOG_WARNING("InChI problem: compound " << compound_->GetID() + << " has an InChI descriptor not starting with the " + << "'InChI=' prefix."); return; } compound_->SetInchi(columns[indices_[DESC]].str()); @@ -108,8 +109,8 @@ void ChemdictParser::OnDataItem(const StarDataItem& item) if (i!=tm_.end()) { compound_->SetChemClass(i->second); } else { - std::cout << "unknown type '" << type << "' for compound " - << compound_->GetID() << std::endl; + LOG_WARNING("unknown type '" << type << "' for compound " + << compound_->GetID()); } } } else if (item.GetName()==StringRef("pdbx_type", 9)) { @@ -121,14 +122,15 @@ void ChemdictParser::OnDataItem(const StarDataItem& item) if (i!=xtm_.end()) { compound_->SetChemType(i->second); } else { - std::cout << "unknown pdbx_type '" << type << "' for compound " - << compound_->GetID() << std::endl; + std::cout << "ERR" << std::endl; + LOG_WARNING("unknown pdbx_type '" << type << "' for compound " + << compound_->GetID()); } } else if (item.GetName()==StringRef("name", 4)) { compound_->SetName(item.GetValue().str()); if (compound_->GetName()==""){ - std::cout << "unknown compound name, chemcomp.name field empty for compound: " - << compound_->GetID() << std::endl; + LOG_WARNING("unknown compound name, chemcomp.name field empty for " + "compound: " << compound_->GetID()); } } else if (item.GetName()==StringRef("formula", 7)) { compound_->SetFormula(item.GetValue().str()); @@ -268,7 +270,7 @@ bool ChemdictParser::IsNameReserved(const String& data_name) data_name == "LIG" ) { - std::cout << "Ignoring reserved compound " << data_name << std::endl; + LOG_SCRIPT("Ignoring reserved compound " << data_name); return true; } return false;