diff --git a/include/mapnik/debug.hpp b/include/mapnik/debug.hpp index 9d7f25c1e..396b89134 100644 --- a/include/mapnik/debug.hpp +++ b/include/mapnik/debug.hpp @@ -23,16 +23,6 @@ #ifndef MAPNIK_DEBUG_HPP #define MAPNIK_DEBUG_HPP -#ifdef MAPNIK_DEBUG -#define MAPNIK_DEBUG_AS_BOOL true -#else -#define MAPNIK_DEBUG_AS_BOOL false -#endif - -#ifndef MAPNIK_LOG_FORMAT -#define MAPNIK_LOG_FORMAT "Mapnik LOG> %Y-%m-%d %H:%M:%S:" -#endif - // mapnik (should not depend on anything else) #include @@ -47,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -124,42 +113,32 @@ namespace mapnik { }; -#define __xstr__(s) __str__(s) -#define __str__(s) #s - - static inline std::string format_logger() + class format { - char buf[256]; - const time_t tm = time(0); - strftime(buf, sizeof(buf), __xstr__(MAPNIK_LOG_FORMAT), localtime(&tm)); - return buf; - } + public: -#undef __xstr__ -#undef __str__ - - -#if 0 - template - class no_output - { - private: - struct null_buffer - { - template - null_buffer &operator<<(const T &) - { - return *this; - } - }; - - typedef null_buffer stream_buffer; - - void operator()(const stream_buffer &) + static std::string get() { + return format_; } - }; + + static void set(const std::string& format) + { +#ifdef MAPNIK_THREADSAFE + boost::mutex::scoped_lock lock(mutex_); #endif + format_ = format; + } + + static std::string str(); + + private: + static std::string format_; + +#ifdef MAPNIK_THREADSAFE + static boost::mutex mutex_; +#endif + }; template @@ -174,7 +153,7 @@ namespace mapnik { static boost::mutex mutex; boost::mutex::scoped_lock lock(mutex); #endif - std::clog << format_logger() << " " << s.str() << std::endl; + std::clog << format::str() << " " << s.str() << std::endl; } }; @@ -193,28 +172,35 @@ namespace mapnik { base_log(const char* object_name) { +#ifdef MAPNIK_LOG if (object_name != NULL) { object_name_ = object_name; } +#endif } ~base_log() { +#ifdef MAPNIK_LOG if (check_severity()) { output_policy()(streambuf_); } +#endif } template base_log &operator<<(const T &x) { +#ifdef MAPNIK_LOG streambuf_ << x; +#endif return *this; } private: +#ifdef MAPNIK_LOG inline bool check_severity() { return Severity >= severity::get_object(object_name_); @@ -222,6 +208,7 @@ namespace mapnik { typename output_policy::stream_buffer streambuf_; std::string object_name_; +#endif }; } diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index d0997e1ad..ce06ef274 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -221,9 +221,7 @@ void csv_datasource::parse_csv(T& stream, { sep = "\t"; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected tab separator"; -#endif } } else // pipes @@ -233,9 +231,7 @@ void csv_datasource::parse_csv(T& stream, { sep = "|"; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected '|' separator"; -#endif } else // semicolons { @@ -244,9 +240,7 @@ void csv_datasource::parse_csv(T& stream, { sep = ";"; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected ';' separator"; -#endif } } } @@ -263,9 +257,7 @@ void csv_datasource::parse_csv(T& stream, std::string quo = boost::trim_copy(quote); if (quo.empty()) quo = "\""; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(csv) << "csv_datasource: csv grammer: sep: '" << sep << "' quo: '" << quo << "' esc: '" << esc; -#endif boost::escaped_list_separator grammer; try @@ -430,9 +422,8 @@ void csv_datasource::parse_csv(T& stream, { if ((row_limit_ > 0) && (line_number > row_limit_)) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(csv) << "csv_datasource: row limit hit, exiting at feature: " << feature_count; -#endif + break; } @@ -447,9 +438,7 @@ void csv_datasource::parse_csv(T& stream, { ++line_number; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(csv) << "csv_datasource: empty row encountered at line: " << line_number; -#endif continue; } diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index 226eb8719..05fe41626 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -50,9 +50,7 @@ using mapnik::datasource_exception; */ inline GDALDataset* gdal_datasource::open_dataset() const { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Opening " << dataset_name_; -#endif GDALDataset *dataset; #if GDAL_VERSION_NUM >= 1600 @@ -81,9 +79,7 @@ gdal_datasource::gdal_datasource(parameters const& params, bool bind) filter_factor_(*params_.get("filter_factor", 0.0)), nodata_value_(params_.get("nodata")) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing..."; -#endif GDALAllRegister(); @@ -128,9 +124,7 @@ void gdal_datasource::bind() const boost::optional bbox_s = params_.get("bbox"); if (bbox_s) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s; -#endif bbox_override = extent_.from_string(*bbox_s); if (! bbox_override) @@ -153,12 +147,10 @@ void gdal_datasource::bind() const dataset->GetGeoTransform(tr); } -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource Geotransform=" << tr[0] << "," << tr[1] << "," << tr[2] << "," << tr[3] << "," << tr[4] << "," << tr[5]; -#endif // TODO - We should throw for true non-north up images, but the check // below is clearly too restrictive. @@ -193,10 +185,8 @@ void gdal_datasource::bind() const GDALClose(dataset); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Size=" << width_ << "," << height_; MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Extent=" << extent_; -#endif is_bound_ = true; } diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index 212126ca2..959b1d009 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -76,9 +76,7 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset, gdal_featureset::~gdal_featureset() { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Closing Dataset=" << &dataset_; -#endif GDALClose(&dataset_); } @@ -89,9 +87,7 @@ feature_ptr gdal_featureset::next() { first_ = false; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Next feature in Dataset=" << &dataset_; -#endif query *q = boost::get(&gquery_); if (q) @@ -122,7 +118,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) GDALRasterBand * grey = 0; /* -#ifdef MAPNIK_DEBUG +#ifdef MAPNIK_LOG double tr[6]; dataset_.GetGeoTransform(tr); @@ -188,12 +184,10 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) box2d feature_raster_extent(x_off, y_off, x_off + width, y_off + height); intersect = t.backward(feature_raster_extent); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Raster extent=" << raster_extent_; MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: View extent=" << intersect; MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution()); - MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: StartX=%d StartY=%d Width=%d Height=%d") % x_off % y_off % width % height; -#endif + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: StartX=" << x_off << " StartY=" << y_off << " Width=" << width << " Height=" << height; if (width > 0 && height > 0) { @@ -208,9 +202,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) im_width *= filter_factor_; im_height *= filter_factor_; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Applying layer filter_factor=" << filter_factor_; -#endif } // otherwise respect symbolizer level factor applied to query, default of 1.0 else @@ -233,10 +225,9 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) mapnik::image_data_32 image(im_width, im_height); image.set(0xffffffff); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Image Size=(" << im_width << "," << im_height << ")"; MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Reading band=" << band_; -#endif + typedef std::vector pallete; if (band_ > 0) // we are querying a single band @@ -284,78 +275,74 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) { case GCI_RedBand: red = band; -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found red band"; -#endif + break; case GCI_GreenBand: green = band; -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found green band"; -#endif + break; case GCI_BlueBand: blue = band; -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found blue band"; -#endif + break; case GCI_AlphaBand: alpha = band; -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found alpha band"; -#endif + break; case GCI_GrayIndex: grey = band; -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found gray band"; -#endif + break; case GCI_PaletteIndex: { grey = band; -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found gray band, and colortable..."; -#endif + GDALColorTable *color_table = band->GetColorTable(); if (color_table) { int count = color_table->GetColorEntryCount(); -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Color Table count=" << count; -#endif + for (int j = 0; j < count; j++) { const GDALColorEntry *ce = color_table->GetColorEntry (j); if (! ce) continue; -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Color entry RGB=" << ce->c1 << "," <c2 << "," << ce->c3; -#endif } } break; } case GCI_Undefined: -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found undefined band (assumming gray band)"; -#endif + grey = band; break; default: -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(gdal) << "gdal_featureset: Band type unknown!"; -#endif + break; } } if (red && green && blue) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Processing rgb bands..."; -#endif + int hasNoData(0); double nodata(0); if (nodata_value_) @@ -406,9 +393,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) } else if (grey) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Processing gray band..."; -#endif + int hasNoData(0); double nodata(0); if (nodata_value_) @@ -424,9 +410,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) if (hasNoData && ! color_table) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: No data value for layer=" << nodata; -#endif + feature->put("NODATA",nodata); // first read the data in and create an alpha channel from the nodata values float* imageData = (float*)image.getBytes(); @@ -458,9 +443,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) if (color_table) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Loading colour table..."; -#endif + unsigned nodata_value = static_cast(nodata); if (hasNoData) { @@ -498,9 +482,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) } if (alpha) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: processing alpha band..."; -#endif + alpha->RasterIO(GF_Read, x_off, y_off, width, height, image.getBytes() + 3, image.width(), image.height(), GDT_Byte, 4, 4 * image.width()); } @@ -535,10 +518,9 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt) if (x < raster_xsize && y < raster_ysize) { -#ifdef MAPNIK_LOG - MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: pt.x=%f pt.y=%f") % pt.x % pt.y; - MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: x=%f y=%f") % x % y; -#endif + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: pt.x=" << pt.x << " pt.y=" << pt.y; + MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: x=" << x << " y=" << y; + GDALRasterBand* band = dataset_.GetRasterBand(band_); int hasNoData; double nodata = band->GetNoDataValue(&hasNoData); diff --git a/plugins/input/geos/geos_datasource.cpp b/plugins/input/geos/geos_datasource.cpp index 62e0c5159..8b830a2cc 100644 --- a/plugins/input/geos/geos_datasource.cpp +++ b/plugins/input/geos/geos_datasource.cpp @@ -159,9 +159,7 @@ void geos_datasource::bind() const mapnik::progress_timer __stats2__(std::clog, "geos_datasource::bind(initialize_extent)"); #endif -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Initializing extent from geometry"; -#endif if (GEOSGeomTypeId(*geometry_) == GEOS_POINT) { @@ -194,9 +192,7 @@ void geos_datasource::bind() const const GEOSCoordSequence* cs = GEOSGeom_getCoordSeq(exterior); if (cs != NULL) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Iterating boundary points"; -#endif double x, y; double minx = std::numeric_limits::max(), @@ -313,9 +309,7 @@ featureset_ptr geos_datasource::features(query const& q) const << extent.minx() << " " << extent.miny() << "))"; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using extent=" << s.str(); -#endif return boost::make_shared(*geometry_, GEOSGeomFromWKT(s.str().c_str()), @@ -336,9 +330,7 @@ featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const std::ostringstream s; s << "POINT(" << pt.x << " " << pt.y << ")"; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using point=" << s.str(); -#endif return boost::make_shared(*geometry_, GEOSGeomFromWKT(s.str().c_str()), diff --git a/plugins/input/geos/geos_featureset.cpp b/plugins/input/geos/geos_featureset.cpp index c2da0e730..6c5ab0ef8 100644 --- a/plugins/input/geos/geos_featureset.cpp +++ b/plugins/input/geos/geos_featureset.cpp @@ -105,9 +105,7 @@ feature_ptr geos_featureset::next() break; default: -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(geos) << "geos_featureset: Unknown extent geometry_type=" << type; -#endif break; } } diff --git a/plugins/input/kismet/kismet_datasource.cpp b/plugins/input/kismet/kismet_datasource.cpp index a061cac84..ec4ab5fb7 100644 --- a/plugins/input/kismet/kismet_datasource.cpp +++ b/plugins/input/kismet/kismet_datasource.cpp @@ -156,9 +156,7 @@ featureset_ptr kismet_datasource::features(query const& q) const { if (! is_bound_) bind(); -#ifdef MAPNIK_LOG - // MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features()"; -#endif + MAPNIK_LOG_INFO(kismet) << "kismet_datasource::features()"; // TODO: use box2d to filter bbox before adding to featureset_ptr // mapnik::box2d const& e = q.get_bbox(); @@ -176,18 +174,14 @@ featureset_ptr kismet_datasource::features_at_point(coord2d const& pt) const { if (! is_bound_) bind(); -#ifdef MAPNIK_LOG - // MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features_at_point()"; -#endif + MAPNIK_LOG_INFO(kismet) << "kismet_datasource::features_at_point()"; return featureset_ptr(); } void kismet_datasource::run(const std::string& ip_host, const unsigned int port) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Enter run"; -#endif int sockfd, n; struct sockaddr_in sock_addr; @@ -252,9 +246,7 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port) buffer[n] = '\0'; std::string bufferObj(buffer); // TCP data send from kismet_server as STL string -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: buffer_obj=" << bufferObj; -#endif std::string::size_type found = 0; std::string::size_type search_start = 0; @@ -266,9 +258,7 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port) { kismet_line.assign(bufferObj, search_start, found - search_start); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: line=" << kismet_line; -#endif int param_number = 5; // the number of parameters to parse @@ -281,13 +271,11 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port) &bestlat, &bestlon) == param_number) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: ssid=" << ssid << ", bssid=" << bssid << ", crypt=" << crypt << ", bestlat=" << bestlat << ", bestlon=" << bestlon; -#endif kismet_network_data knd(ssid, bssid, bestlat, bestlon, crypt); @@ -319,8 +307,6 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port) close(sockfd); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Exit run"; -#endif } diff --git a/plugins/input/occi/occi_datasource.cpp b/plugins/input/occi/occi_datasource.cpp index dff242a6b..3e85ddfe1 100644 --- a/plugins/input/occi/occi_datasource.cpp +++ b/plugins/input/occi/occi_datasource.cpp @@ -203,9 +203,7 @@ void occi_datasource::bind() const s << " AND LOWER(column_name) = LOWER('" << geometry_field_ << "')"; } -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); -#endif try { @@ -243,9 +241,7 @@ void occi_datasource::bind() const std::ostringstream s; s << "SELECT " << fields_ << " FROM (" << table_name_ << ") WHERE rownum < 1"; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); -#endif try { @@ -335,17 +331,13 @@ void occi_datasource::bind() const case oracle::occi::OCCI_SQLT_CLOB: case oracle::occi::OCCI_SQLT_BLOB: case oracle::occi::OCCI_SQLT_RSET: -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(occi) << "occi_datasource: Unsupported datatype " << occi_enums::resolve_datatype(type_oid) << " (type_oid=" << type_oid << ")"; -#endif break; default: -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(occi) << "occi_datasource: Unknown datatype " << "(type_oid=" << type_oid << ")"; -#endif break; } } @@ -391,9 +383,7 @@ box2d occi_datasource::envelope() const s << " (SELECT SDO_AGGR_MBR(" << geometry_field_ << ") shape FROM " << table_ << ") a, "; s << " TABLE(SDO_UTIL.GETVERTICES(a.shape)) c"; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); -#endif try { @@ -439,9 +429,7 @@ box2d occi_datasource::envelope() const s << METADATA_TABLE << " m, TABLE(m.diminfo) dim "; s << " WHERE LOWER(m.table_name) = LOWER('" << table_name_ << "') AND dim.sdo_dimname = 'Y'"; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); -#endif try { @@ -590,9 +578,7 @@ featureset_ptr occi_datasource::features(query const& q) const s << query; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); -#endif return boost::make_shared(pool_, conn_, @@ -680,9 +666,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const s << query; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str(); -#endif return boost::make_shared(pool_, conn_, diff --git a/plugins/input/occi/occi_featureset.cpp b/plugins/input/occi/occi_featureset.cpp index f0c21700b..55203bd8e 100644 --- a/plugins/input/occi/occi_featureset.cpp +++ b/plugins/input/occi/occi_featureset.cpp @@ -205,19 +205,15 @@ feature_ptr occi_featureset::next() case oracle::occi::OCCI_SQLT_BLOB: case oracle::occi::OCCI_SQLT_RSET: { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(occi) << "occi_featureset: Unsupported datatype " << occi_enums::resolve_datatype(type_oid) << " (type_oid=" << type_oid << ")"; -#endif break; } default: // shouldn't get here { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(occi) << "occi_featureset: Unknown datatype " << "(type_oid=" << type_oid << ")"; -#endif break; } } @@ -359,11 +355,9 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) case SDO_GTYPE_UNKNOWN: default: { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(occi) << "occi_featureset: Unknown oracle enum " << occi_enums::resolve_gtype(geomtype) << "(gtype=" << gtype << ")"; -#endif } break; } diff --git a/plugins/input/occi/occi_types.hpp b/plugins/input/occi/occi_types.hpp index fc7992d9c..80ce6a88d 100644 --- a/plugins/input/occi/occi_types.hpp +++ b/plugins/input/occi/occi_types.hpp @@ -88,9 +88,7 @@ public: { if (env_ == 0) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(occi) << "occi_environment: constructor"; -#endif const int mode = oracle::occi::Environment::OBJECT | oracle::occi::Environment::THREADED_MUTEXED; @@ -112,9 +110,7 @@ private: { if (env_) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(occi) << "occi_environment: destructor"; -#endif oracle::occi::Environment::terminateEnvironment(env_); env_ = 0; diff --git a/plugins/input/ogr/ogr_converter.cpp b/plugins/input/ogr/ogr_converter.cpp index 294768474..ffee9cb9a 100644 --- a/plugins/input/ogr/ogr_converter.cpp +++ b/plugins/input/ogr/ogr_converter.cpp @@ -70,10 +70,8 @@ void ogr_converter::convert_geometry(OGRGeometry* geom, feature_ptr feature) case wkbUnknown: default: { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_converter: unknown geometry_type=" << wkbFlatten(geom->getGeometryType()); -#endif } break; } diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index 41182968b..4831bd847 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -269,7 +269,6 @@ void ogr_datasource::bind() const indexed_ = true; index_file.close(); } -#ifdef MAPNIK_LOG #if 0 // TODO - enable this warning once the ogrindex tool is a bit more stable/mature else @@ -278,7 +277,6 @@ void ogr_datasource::bind() const << ", use the 'ogrindex' program to build an index for faster rendering"; } #endif -#endif // MAPNIK_LOG #ifdef MAPNIK_STATS mapnik::progress_timer __stats2__(std::clog, "ogr_datasource::bind(get_column_description)"); @@ -319,18 +317,14 @@ void ogr_datasource::bind() const case OFTRealList: case OFTStringList: case OFTWideStringList: // deprecated ! -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid; -#endif break; case OFTDate: case OFTTime: case OFTDateTime: // unhandled ! -#ifdef MAPNIK_LOG - MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid; -#endif desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::Object)); + MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid; break; } } diff --git a/plugins/input/ogr/ogr_featureset.cpp b/plugins/input/ogr/ogr_featureset.cpp index d1f679013..de9f185b7 100644 --- a/plugins/input/ogr/ogr_featureset.cpp +++ b/plugins/input/ogr/ogr_featureset.cpp @@ -103,12 +103,11 @@ feature_ptr ogr_featureset::next() { ogr_converter::convert_geometry(geom, feature); } -#ifdef MAPNIK_LOG else { MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: Feature with null geometry=" << (*feat)->GetFID(); } -#endif + ++count_; int fld_count = layerdef_->GetFieldCount(); @@ -145,17 +144,13 @@ feature_ptr ogr_featureset::next() case OFTStringList: case OFTWideStringList: // deprecated ! { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid; -#endif break; } case OFTBinary: { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid; -#endif //feature->put(name,feat->GetFieldAsBinary (i, size)); break; } @@ -164,17 +159,13 @@ feature_ptr ogr_featureset::next() case OFTTime: case OFTDateTime: // unhandled ! { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid; -#endif break; } default: // unknown { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unknown type_oid=" << type_oid; -#endif break; } } @@ -182,9 +173,7 @@ feature_ptr ogr_featureset::next() return feature; } -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: " << count_ << " features"; -#endif return feature_ptr(); } diff --git a/plugins/input/ogr/ogr_index_featureset.cpp b/plugins/input/ogr/ogr_index_featureset.cpp index b0410878a..7a37b04b1 100644 --- a/plugins/input/ogr/ogr_index_featureset.cpp +++ b/plugins/input/ogr/ogr_index_featureset.cpp @@ -76,9 +76,7 @@ ogr_index_featureset::ogr_index_featureset(mapnik::context_ptr const & std::sort(ids_.begin(),ids_.end()); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Query size=" << ids_.size(); -#endif itr_ = ids_.begin(); @@ -110,12 +108,10 @@ feature_ptr ogr_index_featureset::next() { ogr_converter::convert_geometry (geom, feature); } -#ifdef MAPNIK_LOG else { MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Feature with null geometry=" << (*feat)->GetFID(); } -#endif int fld_count = layerdef_->GetFieldCount(); for (int i = 0; i < fld_count; i++) @@ -151,17 +147,13 @@ feature_ptr ogr_index_featureset::next() case OFTStringList: case OFTWideStringList: // deprecated ! { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; -#endif break; } case OFTBinary: { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; -#endif //feature->put(name,feat->GetFieldAsBinary (i, size)); break; } @@ -170,9 +162,7 @@ feature_ptr ogr_index_featureset::next() case OFTTime: case OFTDateTime: // unhandled ! { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid; -#endif break; } } diff --git a/plugins/input/ogr/ogr_layer_ptr.hpp b/plugins/input/ogr/ogr_layer_ptr.hpp index 1a3d580b4..78112a6cb 100644 --- a/plugins/input/ogr/ogr_layer_ptr.hpp +++ b/plugins/input/ogr/ogr_layer_ptr.hpp @@ -78,9 +78,7 @@ public: layer_ = ogr_layer; is_valid_ = true; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_name layer=" << layer_name_; -#endif } #ifdef MAPNIK_LOG @@ -105,9 +103,7 @@ public: layer_name_ = def->GetName(); is_valid_ = true; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_index layer=" << layer_name_; -#endif } } @@ -141,9 +137,7 @@ public: layer_name_ = def->GetName(); is_valid_ = true; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_sql layer=" << layer_name_; -#endif } } diff --git a/plugins/input/osm/dataset_deliverer.cpp b/plugins/input/osm/dataset_deliverer.cpp index a231dc11f..0b7e848af 100644 --- a/plugins/input/osm/dataset_deliverer.cpp +++ b/plugins/input/osm/dataset_deliverer.cpp @@ -83,9 +83,7 @@ osm_dataset* dataset_deliverer::load_from_url(const string& url, const string& b } else if (bbox != last_bbox) { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(osm) << "osm_dataset_deliverer: BBoxes are different=" << last_bbox << "," << bbox; -#endif // Reload the dataset dataset->clear(); diff --git a/plugins/input/osm/osm.cpp b/plugins/input/osm/osm.cpp index 54ab620e5..96142a5a3 100644 --- a/plugins/input/osm/osm.cpp +++ b/plugins/input/osm/osm.cpp @@ -49,9 +49,7 @@ bool osm_dataset::load_from_url(const std::string& url, { if (parser == "libxml2") { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(osm) << "osm_dataset: load_from_url url=" << url << ",bbox=" << bbox; -#endif std::ostringstream str; // use curl to grab the data @@ -59,9 +57,7 @@ bool osm_dataset::load_from_url(const std::string& url, str << url << "?bbox=" << bbox; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Full url=" << str.str(); -#endif CURL_LOAD_DATA* resp = grab_http_response(str.str().c_str()); @@ -71,9 +67,7 @@ bool osm_dataset::load_from_url(const std::string& url, memcpy(blx, resp->data, resp->nbytes); blx[resp->nbytes] = '\0'; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(osm) << "osm_dataset: CURL Response=" << blx; -#endif delete[] blx; bool success = osmparser::parse(this, resp->data, resp->nbytes); @@ -90,13 +84,9 @@ osm_dataset::~osm_dataset() void osm_dataset::clear() { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Clear"; -#endif -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(osm) << "osm_dataset: -- Deleting ways"; -#endif for (unsigned int count = 0; count < ways.size(); ++count) { delete ways[count]; @@ -104,9 +94,7 @@ void osm_dataset::clear() } ways.clear(); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(osm) << "osm_dataset: -- Deleting nodes"; -#endif for (unsigned int count = 0; count < nodes.size(); ++count) { delete nodes[count]; @@ -114,9 +102,7 @@ void osm_dataset::clear() } nodes.clear(); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Clear done"; -#endif } std::string osm_dataset::to_string() diff --git a/plugins/input/osm/osm_datasource.cpp b/plugins/input/osm/osm_datasource.cpp index 79a19e470..8835e0339 100644 --- a/plugins/input/osm/osm_datasource.cpp +++ b/plugins/input/osm/osm_datasource.cpp @@ -79,9 +79,7 @@ void osm_datasource::bind() const if (url != "" && bbox != "") { // if we supplied a url and a bounding box, load from the url -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(osm) << "osm_datasource: loading_from_url url=" << url << ",bbox=" << bbox; -#endif if ((osm_data_ = dataset_deliverer::load_from_url(url, bbox, parser)) == NULL) { diff --git a/plugins/input/postgis/connection.hpp b/plugins/input/postgis/connection.hpp index f0e10e0bf..5f8bf34dd 100644 --- a/plugins/input/postgis/connection.hpp +++ b/plugins/input/postgis/connection.hpp @@ -81,9 +81,8 @@ public: { PQfinish(conn_); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(postgis) << "postgis_connection: postgresql connection closed - " << conn_; -#endif + closed_ = true; } } @@ -162,9 +161,8 @@ public: { PQfinish(conn_); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(postgis) << "postgis_connection: datasource closed, also closing connection - " << conn_; -#endif + closed_ = true; } } diff --git a/plugins/input/postgis/cursorresultset.hpp b/plugins/input/postgis/cursorresultset.hpp index 3fac97658..611e394f8 100644 --- a/plugins/input/postgis/cursorresultset.hpp +++ b/plugins/input/postgis/cursorresultset.hpp @@ -88,9 +88,8 @@ public: std::ostringstream s; s << "CLOSE " << cursorName_; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: " << s.str(); -#endif + conn_->execute(s.str()); is_closed_ = true; } @@ -159,15 +158,12 @@ private: std::ostringstream s; s << "FETCH FORWARD " << fetch_size_ << " FROM " << cursorName_; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: " << s.str(); -#endif + rs_ = conn_->executeQuery(s.str()); is_closed_ = false; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: FETCH result (" << cursorName_ << "): " << rs_->size() << " rows"; -#endif } boost::shared_ptr conn_; diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index c4bc87f0b..223cf12aa 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -265,10 +265,9 @@ void postgis_datasource::bind() const if (key_field_string) { key_field_ = std::string(key_field_string); -#ifdef MAPNIK_LOG + MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: auto-detected key field of '" << key_field_ << "' on table '" << geometry_table_ << "'"; -#endif } } else @@ -308,17 +307,13 @@ void postgis_datasource::bind() const { srid_ = -1; -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Table " << table_ << " is using SRID=-1"; -#endif } // At this point the geometry_field may still not be known // but we'll catch that where more useful... -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Using SRID=" << srid_; MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Using geometry_column=" << geometryColumn_; -#endif // collect attribute desc #ifdef MAPNIK_STATS @@ -846,9 +841,7 @@ box2d postgis_datasource::envelope() const } else { -#ifdef MAPNIK_LOG - MAPNIK_LOG_DEBUG(postgis) << boost::format("postgis_datasource: Could not determine extent from query: %s") % s.str(); -#endif + MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Could not determine extent from query: " << s.str(); } } rs->close(); diff --git a/plugins/input/postgis/postgis_featureset.cpp b/plugins/input/postgis/postgis_featureset.cpp index 11e63e62a..7c227894e 100644 --- a/plugins/input/postgis/postgis_featureset.cpp +++ b/plugins/input/postgis/postgis_featureset.cpp @@ -198,9 +198,8 @@ feature_ptr postgis_featureset::next() default: { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(postgis) << "postgis_featureset: Uknown type_oid=" << oid; -#endif + break; } } diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index b72046e47..7e8509133 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -52,9 +52,7 @@ raster_datasource::raster_datasource(const parameters& params, bool bind) desc_(*params.get("type"), "utf-8"), extent_initialized_(false) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing..."; -#endif boost::optional file = params.get("file"); if (! file) throw datasource_exception("Raster Plugin: missing parameter "); @@ -150,9 +148,7 @@ void raster_datasource::bind() const } } -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Raster size=" << width_ << "," << height_; -#endif is_bound_ = true; } @@ -197,15 +193,11 @@ featureset_ptr raster_datasource::features(query const& q) const const int width = int(ext.maxx() + 0.5) - int(ext.minx() + 0.5); const int height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Box size=" << width << "," << height; -#endif if (multi_tiles_) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Multi-Tiled policy"; -#endif tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_); @@ -213,9 +205,7 @@ featureset_ptr raster_datasource::features(query const& q) const } else if (width * height > 512*512) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Tiled policy"; -#endif tiled_file_policy policy(filename_, format_, 256, extent_, q.get_bbox(), width_, height_); @@ -223,9 +213,7 @@ featureset_ptr raster_datasource::features(query const& q) const } else { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Single file"; -#endif raster_info info(filename_, format_, extent_, width_, height_); single_file_policy policy(info); @@ -236,9 +224,7 @@ featureset_ptr raster_datasource::features(query const& q) const featureset_ptr raster_datasource::features_at_point(coord2d const&) const { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported"; -#endif return featureset_ptr(); } diff --git a/plugins/input/raster/raster_featureset.cpp b/plugins/input/raster/raster_featureset.cpp index 4df7e70a6..bd26a076f 100644 --- a/plugins/input/raster/raster_featureset.cpp +++ b/plugins/input/raster/raster_featureset.cpp @@ -70,10 +70,8 @@ feature_ptr raster_featureset::next() { std::auto_ptr reader(mapnik::get_image_reader(curIter_->file(),curIter_->format())); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "raster_featureset: Reader=" << curIter_->format() << "," << curIter_->file() << ",size(" << curIter_->width() << "," << curIter_->height() << ")"; -#endif if (reader.get()) { diff --git a/plugins/input/raster/raster_featureset.hpp b/plugins/input/raster/raster_featureset.hpp index d87b0f8dc..fe72e06c0 100644 --- a/plugins/input/raster/raster_featureset.hpp +++ b/plugins/input/raster/raster_featureset.hpp @@ -140,9 +140,7 @@ public: double pixel_x = extent.width() / double(width); double pixel_y = extent.height() / double(height); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "tiled_file_policy: Raster Plugin PIXEL SIZE("<< pixel_x << "," << pixel_y << ")"; -#endif box2d e = bbox.intersect(extent); @@ -164,9 +162,7 @@ public: } } -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "tiled_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file; -#endif } const_iterator begin() @@ -227,9 +223,7 @@ public: double pixel_x = extent.width() / double(width); double pixel_y = extent.height() / double(height); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "tiled_multi_file_policy: Raster Plugin PIXEL SIZE(" << pixel_x << "," << pixel_y << ")"; -#endif // intersection of query with extent => new query box2d e = bbox.intersect(extent); @@ -261,9 +255,7 @@ public: } } -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(raster) << "tiled_multi_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file_pattern; -#endif } const_iterator begin() diff --git a/plugins/input/rasterlite/rasterlite_datasource.cpp b/plugins/input/rasterlite/rasterlite_datasource.cpp index 6b2d22c63..3fd3c73ef 100644 --- a/plugins/input/rasterlite/rasterlite_datasource.cpp +++ b/plugins/input/rasterlite/rasterlite_datasource.cpp @@ -75,9 +75,7 @@ rasterlite_datasource::rasterlite_datasource(parameters const& params, bool bind : datasource(params), desc_(*params.get("type"),"utf-8") { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Initializing..."; -#endif boost::optional file = params.get("file"); if (!file) throw datasource_exception("missing parameter"); diff --git a/plugins/input/rasterlite/rasterlite_featureset.cpp b/plugins/input/rasterlite/rasterlite_featureset.cpp index aa289957a..772ccc3fa 100644 --- a/plugins/input/rasterlite/rasterlite_featureset.cpp +++ b/plugins/input/rasterlite/rasterlite_featureset.cpp @@ -55,9 +55,7 @@ rasterlite_featureset::rasterlite_featureset(void* dataset, rasterlite_featureset::~rasterlite_featureset() { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Closing"; -#endif rasterliteClose(dataset_); } @@ -88,9 +86,7 @@ feature_ptr rasterlite_featureset::next() feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Running get_feature"; -#endif feature_ptr feature(feature_factory::create(ctx_,1)); @@ -106,14 +102,12 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q) const double pixel_size = (intersect.width() >= intersect.height()) ? (intersect.width() / (double) width) : (intersect.height() / (double) height); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Raster extent=" << raster_extent; MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: View extent=" << q.get_bbox(); MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Intersect extent=" << intersect; MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution()); MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Size=" << width << " " << height; MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Pixel Size=" << pixel_size; -#endif if (width > 0 && height > 0) { @@ -146,9 +140,7 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q) free (raster); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Done"; -#endif } else { diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 26092b11c..5ceb23284 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -140,12 +140,10 @@ void shape_datasource::bind() const break; } default: -#ifdef MAPNIK_LOG // I - long // G - ole // + - autoincrement MAPNIK_LOG_WARN(shape) << "shape_datasource: Unknown type=" << fd.type_; -#endif break; } } @@ -231,18 +229,13 @@ void shape_datasource::init(shape_io& shape) const //} //else //{ - // #ifdef MAPNIK_LOG // MAPNIK_LOG_DEBUG(shape) << "shape_datasource: No .index file found for " // << shape_name_ << ".shp, use the 'shapeindex' program to build an index for faster rendering"; - // #endif //} -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Extent=" << extent_; MAPNIK_LOG_DEBUG(shape) << "shape_datasource: File length=" << file_length_; MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Shape type=" << shape_type_; -#endif - } std::string shape_datasource::name() diff --git a/plugins/input/shape/shape_featureset.cpp b/plugins/input/shape/shape_featureset.cpp index 01259e33d..6a817d80a 100644 --- a/plugins/input/shape/shape_featureset.cpp +++ b/plugins/input/shape/shape_featureset.cpp @@ -147,9 +147,8 @@ feature_ptr shape_featureset::next() } else { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_; -#endif + return feature_ptr(); } } @@ -257,9 +256,8 @@ feature_ptr shape_featureset::next() } else { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_; -#endif + return feature_ptr(); } } diff --git a/plugins/input/shape/shape_index_featureset.cpp b/plugins/input/shape/shape_index_featureset.cpp index d37b42d4d..904c7290c 100644 --- a/plugins/input/shape/shape_index_featureset.cpp +++ b/plugins/input/shape/shape_index_featureset.cpp @@ -67,9 +67,7 @@ shape_index_featureset::shape_index_featureset(filterT const& filter, std::sort(ids_.begin(), ids_.end()); -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: Query size=" << ids_.size(); -#endif itr_ = ids_.begin(); } @@ -202,10 +200,8 @@ feature_ptr shape_index_featureset::next() } else { - -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: " << count_ << " features"; -#endif + return feature_ptr(); } } diff --git a/plugins/input/shape/shape_io.cpp b/plugins/input/shape/shape_io.cpp index ddc196c10..7b8c27fe3 100644 --- a/plugins/input/shape/shape_io.cpp +++ b/plugins/input/shape/shape_io.cpp @@ -58,9 +58,7 @@ shape_io::shape_io(const std::string& shape_name, bool open_index) } catch (...) { -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(shape) << "shape_io: Could not open index=" << shape_name << INDEX; -#endif } } } diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index b3000c778..11aac4dd6 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -215,9 +215,8 @@ void sqlite_datasource::bind() const for (std::vector::const_iterator iter = init_statements_.begin(); iter != init_statements_.end(); ++iter) { -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: Execute init sql=" << *iter; -#endif + dataset_->execute(*iter); } @@ -613,9 +612,7 @@ featureset_ptr sqlite_datasource::features(query const& q) const s << " OFFSET " << row_offset_; } -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str(); -#endif boost::shared_ptr rs(dataset_->execute_query(s.str())); @@ -697,9 +694,7 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt) const s << " OFFSET " << row_offset_; } -#ifdef MAPNIK_LOG MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str(); -#endif boost::shared_ptr rs(dataset_->execute_query(s.str())); diff --git a/plugins/input/sqlite/sqlite_featureset.cpp b/plugins/input/sqlite/sqlite_featureset.cpp index ccc48105c..f40b657d6 100644 --- a/plugins/input/sqlite/sqlite_featureset.cpp +++ b/plugins/input/sqlite/sqlite_featureset.cpp @@ -125,9 +125,7 @@ feature_ptr sqlite_featureset::next() break; default: -#ifdef MAPNIK_LOG MAPNIK_LOG_WARN(sqlite) << "sqlite_featureset: Field=" << fld_name_str << " unhandled type_oid=" << type_oid; -#endif break; } } diff --git a/src/debug.cpp b/src/debug.cpp index 684c7e151..a0d0290c3 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -23,14 +23,46 @@ // mapnik #include +// stl +#include + +#ifndef MAPNIK_LOG_FORMAT +#define MAPNIK_LOG_FORMAT "Mapnik LOG> %Y-%m-%d %H:%M:%S:" +#endif + namespace mapnik { namespace logger { +// severity severity::type severity::severity_level_ = - MAPNIK_DEBUG_AS_BOOL ? severity::debug : severity::error; +#ifdef MAPNIK_DEBUG + severity::debug +#else + severity::error +#endif +; severity::severity_map severity::object_severity_level_ = severity::severity_map(); +// format + +#define __xstr__(s) __str__(s) +#define __str__(s) #s + +std::string format::format_ = __xstr__(MAPNIK_LOG_FORMAT); + +#undef __xstr__ +#undef __str__ + +std::string format::str() +{ + char buf[256]; + const time_t tm = time(0); + strftime(buf, sizeof(buf), format::format_.c_str(), localtime(&tm)); + return buf; +} + + } } diff --git a/src/wkb.cpp b/src/wkb.cpp index f26390e2e..e001878fa 100644 --- a/src/wkb.cpp +++ b/src/wkb.cpp @@ -31,8 +31,6 @@ #include #include -// #define MAPNIK_DEBUG_WKB - namespace mapnik { struct wkb_reader : boost::noncopyable @@ -115,9 +113,7 @@ public: { int type = read_integer(); -#if defined(MAPNIK_LOG) && defined(MAPNIK_DEBUG_WKB) - mapnik::log() << "wkb_reader: Read=" << wkb_geometry_type_string(type) << "," << type; -#endif + MAPNIK_LOG_DEBUG(wkb_reader) << "wkb_reader: Read=" << wkb_geometry_type_string(type) << "," << type; switch (type) { @@ -405,7 +401,6 @@ private: } } -#if defined(MAPNIK_LOG) && defined(MAPNIK_DEBUG_WKB) std::string wkb_geometry_type_string(int type) { std::stringstream s; @@ -431,8 +426,6 @@ private: return s.str(); } -#endif - }; void geometry_utils::from_wkb (boost::ptr_vector& paths,