- avoid using clog/cerr in sqlite plugin (use mapnik::logging facilities instead)

This commit is contained in:
kunitoki 2013-03-27 09:02:40 +01:00
parent af2bb2be1e
commit 26ba946cb0
3 changed files with 19 additions and 14 deletions

View file

@ -24,6 +24,7 @@
#define MAPNIK_SQLITE_PREPARED_HPP #define MAPNIK_SQLITE_PREPARED_HPP
// mapnik // mapnik
#include <mapnik/debug.hpp>
#include <mapnik/datasource.hpp> #include <mapnik/datasource.hpp>
#include <mapnik/params.hpp> #include <mapnik/params.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
@ -77,11 +78,13 @@ public:
{ {
if (*(*ds_)) if (*(*ds_))
{ {
std::cerr << "ERR:" << sqlite3_errmsg(*(*ds_)) << "\n"; MAPNIK_LOG_ERROR(sqlite) << "~prepared_index_statement:"
<< sqlite3_errmsg(*(*ds_));
} }
else else
{ {
std::cerr << "SQLite Plugin: " << res << "\n"; MAPNIK_LOG_ERROR(sqlite) << "~prepared_index_statement:"
<< res;
} }
} }
} }

View file

@ -24,6 +24,7 @@
#define MAPNIK_SQLITE_RESULTSET_HPP #define MAPNIK_SQLITE_RESULTSET_HPP
// mapnik // mapnik
#include <mapnik/debug.hpp>
#include <mapnik/datasource.hpp> #include <mapnik/datasource.hpp>
#include <mapnik/params.hpp> #include <mapnik/params.hpp>

View file

@ -29,6 +29,7 @@
#include <algorithm> #include <algorithm>
// mapnik // mapnik
#include <mapnik/debug.hpp>
#include <mapnik/datasource.hpp> #include <mapnik/datasource.hpp>
#include <mapnik/params.hpp> #include <mapnik/params.hpp>
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
@ -556,7 +557,7 @@ public:
} }
catch (std::exception const& ex) catch (std::exception const& ex)
{ {
//std::clog << "no: " << ex.what() << "\n"; MAPNIK_LOG_DEBUG(sqlite) << "has_rtree returned:" << ex.what();
return false; return false;
} }
return false; return false;
@ -609,9 +610,7 @@ public:
break; break;
default: default:
#ifdef MAPNIK_DEBUG MAPNIK_LOG_DEBUG(sqlite) << "detect_types_from_subquery: unknown type_oid=" << type_oid;
std::clog << "Sqlite Plugin: unknown type_oid=" << type_oid << std::endl;
#endif
break; break;
} }
} }
@ -691,20 +690,22 @@ public:
desc.add_descriptor(mapnik::attribute_descriptor(fld_name, mapnik::String)); desc.add_descriptor(mapnik::attribute_descriptor(fld_name, mapnik::String));
} }
} }
#ifdef MAPNIK_DEBUG
else else
{ {
// "Column Affinity" says default to "Numeric" but for now we pass.. // "Column Affinity" says default to "Numeric" but for now we pass..
//desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double)); //desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double));
// TODO - this should not fail when we specify geometry_field in XML file #ifdef MAPNIK_LOG
// Do not fail when we specify geometry_field in XML file
std::clog << "Sqlite Plugin: column '" if (field.empty())
<< std::string(fld_name) {
<< "' unhandled due to unknown type: " MAPNIK_LOG_DEBUG(sqlite) << "Column '"
<< fld_type << std::endl; << std::string(fld_name)
} << "' unhandled due to unknown type: "
<< fld_type;
}
#endif #endif
}
} }
} }