Add support for MAPNIK_LOG_SEVERITY env variable
This commit is contained in:
parent
23fb010ea2
commit
bc92a46c64
1 changed files with 16 additions and 0 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue