Add support for MAPNIK_LOG_SEVERITY env variable

This commit is contained in:
Sandro Santilli 2016-03-04 10:43:14 +01:00
parent 23fb010ea2
commit bc92a46c64

View file

@ -30,6 +30,22 @@ int main (int argc,char** argv)
mapnik::logger logger;
logger.set_severity(mapnik::logger::error);
const char *envsev = std::getenv("MAPNIK_LOG_SEVERITY");
if ( envsev != nullptr)
{
if ( ! strncmp(envsev, "deb", 3) )
logger.set_severity(mapnik::logger::debug);
else if ( ! strncmp(envsev, "warn", 4) )
logger.set_severity(mapnik::logger::warn);
else if ( ! strncmp(envsev, "err", 3) )
logger.set_severity(mapnik::logger::error);
else
MAPNIK_LOG_ERROR("logger") <<
"Invalid value for MAPNIK_LOG_SEVERITY"
" environment variable, expected "
"'debug', 'warning' or 'error'";
}
try
{
po::options_description desc("mapnik-render utility");