Merge pull request #2910 from mapycz/improve-visual-test-7
visual tests: add command line argument for controlling log level
This commit is contained in:
commit
79e00ed7d3
1 changed files with 31 additions and 0 deletions
|
@ -31,6 +31,18 @@
|
||||||
|
|
||||||
#include "cleanup.hpp" // run_cleanup()
|
#include "cleanup.hpp" // run_cleanup()
|
||||||
|
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
|
using log_levels_map = std::map<std::string, mapnik::logger::severity_type>;
|
||||||
|
|
||||||
|
log_levels_map log_levels
|
||||||
|
{
|
||||||
|
{ "debug", mapnik::logger::severity_type::debug },
|
||||||
|
{ "warn", mapnik::logger::severity_type::warn },
|
||||||
|
{ "error", mapnik::logger::severity_type::error },
|
||||||
|
{ "none", mapnik::logger::severity_type::none }
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
using namespace visual_tests;
|
using namespace visual_tests;
|
||||||
|
@ -49,6 +61,11 @@ int main(int argc, char** argv)
|
||||||
("styles", po::value<std::vector<std::string>>(), "selected styles to test")
|
("styles", po::value<std::vector<std::string>>(), "selected styles to test")
|
||||||
("fonts", po::value<std::string>()->default_value("fonts"), "font search path")
|
("fonts", po::value<std::string>()->default_value("fonts"), "font search path")
|
||||||
("plugins", po::value<std::string>()->default_value("plugins/input"), "input plugins search path")
|
("plugins", po::value<std::string>()->default_value("plugins/input"), "input plugins search path")
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
|
("log", po::value<std::string>()->default_value(std::find_if(log_levels.begin(), log_levels.end(),
|
||||||
|
[](log_levels_map::value_type const & level) { return level.second == mapnik::logger::get_severity(); } )->first),
|
||||||
|
"log level (debug, warn, error, none)")
|
||||||
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
po::positional_options_description p;
|
po::positional_options_description p;
|
||||||
|
@ -63,6 +80,20 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
|
std::string log_level(vm["log"].as<std::string>());
|
||||||
|
log_levels_map::const_iterator level_iter = log_levels.find(log_level);
|
||||||
|
if (level_iter == log_levels.end())
|
||||||
|
{
|
||||||
|
std::cerr << "Error: Unknown log level: " << log_level << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapnik::logger::set_severity(level_iter->second);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mapnik::freetype_engine::register_fonts(vm["fonts"].as<std::string>(), true);
|
mapnik::freetype_engine::register_fonts(vm["fonts"].as<std::string>(), true);
|
||||||
mapnik::datasource_cache::instance().register_datasources(vm["plugins"].as<std::string>());
|
mapnik::datasource_cache::instance().register_datasources(vm["plugins"].as<std::string>());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue