- Reduced verbosity of PythonPolicyManager`s policies collection process

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1060 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-09-08 10:11:02 +00:00
parent c1d72439b5
commit 284490f271
1 changed files with 12 additions and 8 deletions

View File

@ -110,18 +110,20 @@ PythonCPUPolicyManager::collect_policies()
{
Glib::Dir dir(dir_it->c_str());
cout << "Opening directory " << *dir_it << " looking for python policies..." << endl;
#ifndef NDEBUG
std::clog << "Opening directory " << *dir_it << " looking for python policies..." << endl;
#endif
for (Glib::DirIterator file_it = dir.begin(); file_it != dir.end(); ++file_it)
{
cout << "\tChecking if " << *file_it << " is a valid Python script... ";
Glib::PatternSpec dot_py("*.py");
if (dot_py.match(*file_it))
{
cout << "yes" << endl;
#ifndef NDEBUG
std::clog << "\t" << *file_it << " is a valid Python script. Attempting to load... ";
#endif
//strip extension
std::string policy_name = (*file_it).substr(0, (*file_it).size() - 3);
@ -130,14 +132,16 @@ PythonCPUPolicyManager::collect_policies()
PythonCPUPolicy *pypolicy = new PythonCPUPolicy(policy_name.c_str());
_policies.push_back(pypolicy);
#ifndef NDEBUG
std::clog << "OK\n";
#endif
}
catch (MalformedPolicyException e)
catch (const MalformedPolicyException& e)
{
std::cerr << "POLICY LOAD ERROR: " << e.what() << endl;
std::clog << "POLICY LOAD ERROR: " << e.what() << endl;
}
}
else
cout << "no" << endl;
}
}
}