diff --git a/test/visual/run.cpp b/test/visual/run.cpp index 1353bcc42..d44508188 100644 --- a/test/visual/run.cpp +++ b/test/visual/run.cpp @@ -31,6 +31,18 @@ #include "cleanup.hpp" // run_cleanup() +#ifdef MAPNIK_LOG +using log_levels_map = std::map; + +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) { using namespace visual_tests; @@ -49,6 +61,11 @@ int main(int argc, char** argv) ("styles", po::value>(), "selected styles to test") ("fonts", po::value()->default_value("fonts"), "font search path") ("plugins", po::value()->default_value("plugins/input"), "input plugins search path") +#ifdef MAPNIK_LOG + ("log", po::value()->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; @@ -63,6 +80,20 @@ int main(int argc, char** argv) return 1; } +#ifdef MAPNIK_LOG + std::string log_level(vm["log"].as()); + 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(), true); mapnik::datasource_cache::instance().register_datasources(vm["plugins"].as());