Permalink
Browse files

implement new debug system

  • Loading branch information...
1 parent 19f5f77 commit 1f351e0e097270940c7c9257b5b685176737fac2 @kunitoki kunitoki committed Apr 8, 2012
Showing with 1,867 additions and 1,062 deletions.
  1. +27 −6 SConstruct
  2. +0 −1 bindings/python/mapnik_color.cpp
  3. +0 −1 bindings/python/mapnik_coord.cpp
  4. +3 −1 bindings/python/mapnik_datasource.cpp
  5. +0 −2 bindings/python/mapnik_datasource_cache.cpp
  6. +0 −1 bindings/python/mapnik_envelope.cpp
  7. +3 −2 bindings/python/mapnik_expression.cpp
  8. +0 −3 bindings/python/mapnik_feature.cpp
  9. +1 −1 bindings/python/mapnik_featureset.cpp
  10. +0 −1 bindings/python/mapnik_font_engine.cpp
  11. +0 −1 bindings/python/mapnik_geometry.cpp
  12. +0 −1 bindings/python/mapnik_grid.cpp
  13. +0 −1 bindings/python/mapnik_grid_view.cpp
  14. +0 −1 bindings/python/mapnik_image.cpp
  15. +0 −1 bindings/python/mapnik_image_view.cpp
  16. +0 −1 bindings/python/mapnik_inmem_metawriter.cpp
  17. +0 −2 bindings/python/mapnik_layer.cpp
  18. +0 −1 bindings/python/mapnik_line_pattern_symbolizer.cpp
  19. +0 −1 bindings/python/mapnik_line_symbolizer.cpp
  20. +0 −1 bindings/python/mapnik_map.cpp
  21. +1 −1 bindings/python/mapnik_markers_symbolizer.cpp
  22. +0 −1 bindings/python/mapnik_palette.cpp
  23. +4 −1 bindings/python/mapnik_parameters.cpp
  24. +0 −1 bindings/python/mapnik_point_symbolizer.cpp
  25. +0 −1 bindings/python/mapnik_polygon_pattern_symbolizer.cpp
  26. +0 −1 bindings/python/mapnik_polygon_symbolizer.cpp
  27. +1 −1 bindings/python/mapnik_proj_transform.cpp
  28. +1 −2 bindings/python/mapnik_projection.cpp
  29. +4 −1 bindings/python/mapnik_query.cpp
  30. +3 −1 bindings/python/mapnik_raster_colorizer.cpp
  31. +3 −1 bindings/python/mapnik_raster_symbolizer.cpp
  32. +2 −1 bindings/python/mapnik_rule.cpp
  33. +3 −1 bindings/python/mapnik_shield_symbolizer.cpp
  34. +0 −1 bindings/python/mapnik_stroke.cpp
  35. +2 −1 bindings/python/mapnik_style.cpp
  36. +2 −1 bindings/python/mapnik_symbolizer.cpp
  37. +0 −1 bindings/python/mapnik_view_transform.cpp
  38. +0 −1 bindings/python/python_cairo.cpp
  39. +4 −1 bindings/python/python_grid_utils.hpp
  40. +0 −1 bindings/python/python_optional.hpp
  41. +21 −20 include/mapnik/ctrans.hpp
  42. +11 −0 include/mapnik/datasource.hpp
  43. +127 −0 include/mapnik/debug.hpp
  44. +7 −5 include/mapnik/font_engine_freetype.hpp
  45. +7 −3 include/mapnik/grid/grid.hpp
  46. +1 −1 include/mapnik/json/feature_collection_grammar.hpp
  47. +5 −3 include/mapnik/memory_featureset.hpp
  48. +1 −1 include/mapnik/metawriter_json.hpp
  49. +9 −8 include/mapnik/pool.hpp
  50. +1 −1 include/mapnik/rule.hpp
  51. +8 −5 include/mapnik/svg/svg_renderer.hpp
  52. +58 −22 include/mapnik/timer.hpp
  53. +17 −7 include/mapnik/utils.hpp
  54. +82 −41 plugins/input/csv/csv_datasource.cpp
  55. +24 −1 plugins/input/csv/csv_datasource.hpp
  56. +35 −14 plugins/input/gdal/gdal_datasource.cpp
  57. +1 −2 plugins/input/gdal/gdal_datasource.hpp
  58. +65 −63 plugins/input/gdal/gdal_featureset.cpp
  59. +1 −1 plugins/input/gdal/gdal_featureset.hpp
  60. +45 −14 plugins/input/geos/geos_datasource.cpp
  61. +3 −2 plugins/input/geos/geos_featureset.cpp
  62. +25 −15 plugins/input/kismet/kismet_datasource.cpp
  63. +101 −44 plugins/input/occi/occi_datasource.cpp
  64. +3 −1 plugins/input/occi/occi_datasource.hpp
  65. +49 −33 plugins/input/occi/occi_featureset.cpp
  66. +5 −0 plugins/input/occi/occi_featureset.hpp
  67. +5 −4 plugins/input/occi/occi_types.hpp
  68. +6 −3 plugins/input/ogr/ogr_converter.cpp
  69. +38 −12 plugins/input/ogr/ogr_datasource.cpp
  70. +14 −13 plugins/input/ogr/ogr_featureset.cpp
  71. +11 −11 plugins/input/ogr/ogr_index_featureset.cpp
  72. +15 −12 plugins/input/ogr/ogr_layer_ptr.hpp
  73. +10 −3 plugins/input/osm/dataset_deliverer.cpp
  74. +18 −20 plugins/input/osm/osm.cpp
  75. +14 −7 plugins/input/osm/osm_datasource.cpp
  76. +2 −4 plugins/input/osm/osm_datasource.hpp
  77. +62 −40 plugins/input/postgis/connection.hpp
  78. +12 −7 plugins/input/postgis/connection_manager.hpp
  79. +64 −36 plugins/input/postgis/cursorresultset.hpp
  80. +77 −91 plugins/input/postgis/postgis_datasource.cpp
  81. +2 −5 plugins/input/postgis/postgis_datasource.hpp
  82. +3 −2 plugins/input/postgis/postgis_featureset.cpp
  83. +3 −3 plugins/input/postgis/resultset.hpp
  84. +21 −17 plugins/input/raster/raster_datasource.cpp
  85. +2 −3 plugins/input/raster/raster_datasource.hpp
  86. +4 −3 plugins/input/raster/raster_featureset.cpp
  87. +13 −8 plugins/input/raster/raster_featureset.hpp
  88. +35 −30 plugins/input/rasterlite/rasterlite_datasource.cpp
  89. +2 −1 plugins/input/rasterlite/rasterlite_datasource.hpp
  90. +15 −17 plugins/input/rasterlite/rasterlite_featureset.cpp
  91. +65 −24 plugins/input/shape/shape_datasource.cpp
  92. +2 −4 plugins/input/shape/shape_datasource.hpp
  93. +6 −5 plugins/input/shape/shape_featureset.cpp
  94. +5 −4 plugins/input/shape/shape_index_featureset.cpp
  95. +3 −2 plugins/input/shape/shape_io.cpp
  96. +12 −1 plugins/input/sqlite/sqlite_connection.hpp
  97. +53 −28 plugins/input/sqlite/sqlite_datasource.cpp
  98. +4 −6 plugins/input/sqlite/sqlite_datasource.hpp
  99. +3 −3 plugins/input/sqlite/sqlite_featureset.cpp
  100. +14 −16 src/agg/agg_renderer.cpp
  101. +4 −1 src/agg/process_line_pattern_symbolizer.cpp
  102. +19 −7 src/agg/process_markers_symbolizer.cpp
  103. +7 −2 src/agg/process_polygon_pattern_symbolizer.cpp
  104. +27 −24 src/cairo_renderer.cpp
  105. +20 −15 src/datasource_cache.cpp
  106. +25 −13 src/feature_style_processor.cpp
  107. +8 −4 src/font_engine_freetype.cpp
  108. +18 −20 src/grid/grid_renderer.cpp
  109. +4 −2 src/grid/process_markers_symbolizer.cpp
  110. +4 −1 src/grid/process_raster_symbolizer.cpp
  111. +0 −4 src/jpeg_reader.cpp
  112. +2 −2 src/libxml2_loader.cpp
  113. +64 −22 src/load_map.cpp
  114. +12 −16 src/map.cpp
  115. +1 −3 src/memory.cpp
  116. +5 −3 src/memory_datasource.cpp
  117. +12 −7 src/metawriter.cpp
  118. +8 −8 src/placement_finder.cpp
  119. +6 −5 src/png_reader.cpp
  120. +1 −1 src/proj_transform.cpp
  121. +15 −11 src/raster_colorizer.cpp
  122. +0 −1 src/save_map.cpp
  123. +10 −10 src/svg/svg_renderer.cpp
  124. +3 −3 src/svg_parser.cpp
  125. +3 −2 src/text_properties.cpp
  126. +6 −1 src/text_symbolizer.cpp
  127. +8 −4 src/tiff_reader.cpp
  128. +0 −4 src/unicode.cpp
  129. +7 −11 src/wkb.cpp
  130. +66 −15 tests/python_tests/csv_test.py
  131. +15 −3 tests/python_tests/datasource_test.py
  132. +94 −33 workspace/mapnik.pro
  133. +2 −1 workspace/plugins.pri
View
@@ -325,7 +325,7 @@ opts.AddVariables(
# Variables affecting rendering back-ends
BoolVariable('RENDERING_STATS', 'Output rendering statistics during style processing', 'False'),
-
+
BoolVariable('INTERNAL_LIBAGG', 'Use provided libagg', 'True'),
BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'),
@@ -345,7 +345,12 @@ opts.AddVariables(
PathVariable('SQLITE_LIBS', 'Search path for SQLITE library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
PathVariable('RASTERLITE_INCLUDES', 'Search path for RASTERLITE include files', '/usr/include/', PathVariable.PathAccept),
PathVariable('RASTERLITE_LIBS', 'Search path for RASTERLITE library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
-
+
+ # Variables for logging and statistics
+ BoolVariable('ENABLE_LOG', 'Enable logging, which is enabled by default when building in *debug*', 'False'),
+ BoolVariable('ENABLE_STATS', 'Enable global statistics during map processing', 'False'),
+ ('LOG_FORMAT_STRING', 'The format string used before log output string, piped through strftime (max length of 255 characters)', 'Mapnik LOG> %Y-%m-%d %H:%M:%S:'),
+
# Other variables
BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'),
('SYSTEM_FONTS','Provide location for python bindings to register fonts (if given aborts installation of bundled DejaVu fonts)',''),
@@ -1163,7 +1168,7 @@ if not preconfigured:
env.Append(CXXFLAGS = '-DBOOST_REGEX_HAS_ICU')
else:
env['SKIPPED_DEPS'].append('boost_regex_icu')
-
+
env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
if len(env['REQUESTED_PLUGINS']):
@@ -1411,10 +1416,26 @@ if not preconfigured:
# Common debugging flags.
# http://lists.fedoraproject.org/pipermail/devel/2010-November/144952.html
debug_flags = '-g -fno-omit-frame-pointer -DDEBUG -DMAPNIK_DEBUG'
-
ndebug_flags = '-DNDEBUG'
-
-
+
+ # Enable logging in debug mode (always) and release mode (when specified)
+ log_enabled = ' -DMAPNIK_LOG -DMAPNIK_LOG_FORMAT="%s"' % env['LOG_FORMAT_STRING']
+
+ if env['DEBUG']:
+ debug_flags += log_enabled
+ else:
+ if env['ENABLE_LOG']:
+ ndebug_flags += log_enabled
+
+ # Enable statistics reporting
+ if env['ENABLE_STATS']:
+ debug_flags += ' -DMAPNIK_STATS'
+ ndebug_flags += ' -DMAPNIK_STATS'
+
+ # Add rdynamic to allow using statics between application and plugins
+ # http://stackoverflow.com/questions/8623657/multiple-instances-of-singleton-across-shared-libraries-on-linux
+ env.MergeFlags('-rdynamic')
+
# Customizing the C++ compiler flags depending on:
# (1) the C++ compiler used; and
# (2) whether debug binaries are requested.
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
#include <boost/python.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
#include <boost/python.hpp>
@@ -19,10 +19,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
+
// boost
#include <boost/python.hpp>
#include <boost/python/detail/api_placeholder.hpp>
+
// stl
#include <sstream>
#include <vector>
@@ -89,6 +90,7 @@ boost::python::dict describe(boost::shared_ptr<mapnik::datasource> const& ds)
description["name"] = ld.get_name();
description["geometry_type"] = ds->get_geometry_type();
description["encoding"] = ld.get_encoding();
+ description["log"] = ds->log_enabled();
return description;
}
@@ -20,8 +20,6 @@
*
*****************************************************************************/
-//$Id$
-
#include <boost/python.hpp>
#include <mapnik/datasource_cache.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id: mapnik_envelope.cc 27 2005-03-30 21:45:40Z pavlenko $
// boost
#include <boost/python.hpp>
@@ -19,9 +19,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
+// boost
#include <boost/python.hpp>
+#include <boost/variant.hpp>
+
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/expression.hpp>
@@ -30,7 +32,6 @@
#include <mapnik/parse_path.hpp>
#include <mapnik/value.hpp>
-#include <boost/variant.hpp>
using mapnik::Feature;
using mapnik::expression_ptr;
@@ -19,13 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
-
#include <boost/python/suite/indexing/indexing_suite.hpp>
//#include <boost/python/suite/indexing/map_indexing_suite.hpp>
-
#include <boost/python/iterator.hpp>
#include <boost/python/call_method.hpp>
#include <boost/python/tuple.hpp>
@@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
#include <boost/python.hpp>
+
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/datasource.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
#include <boost/python.hpp>
#include <mapnik/font_engine_freetype.hpp>
@@ -17,7 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
#include <boost/python.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
#include <boost/python.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
#include <boost/python.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
extern "C"
{
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
extern "C"
{
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
#include <boost/python.hpp>
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id: mapnik_layer.cc 17 2005-03-08 23:58:43Z pavlenko $
-
// boost
#include <boost/python.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
#include <boost/python.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
#include <boost/python.hpp>
#include "mapnik_enumeration.hpp"
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id: mapnik_map.cc 17 2005-03-08 23:58:43Z pavlenko $
// boost
#include <boost/python.hpp>
@@ -19,9 +19,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
#include <boost/python.hpp>
+
#include <mapnik/graphics.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/markers_symbolizer.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// boost
#include <boost/python.hpp>
@@ -25,6 +25,7 @@
#include <boost/make_shared.hpp>
// mapnik
+#include <mapnik/debug.hpp>
#include <mapnik/params.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/value.hpp>
@@ -102,7 +103,9 @@ struct parameters_pickle_suite : boost::python::pickle_suite
}
else
{
- std::clog << "could not unpickle key: " << key << "\n";
+#ifdef MAPNIK_LOG
+ mapnik::log() << "parameters_pickle_suite: Could not unpickle key=" << key;
+#endif
}
}
}
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
#include <boost/python.hpp>
#include "mapnik_enumeration.hpp"
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
#include <boost/python.hpp>
#include <mapnik/image_util.hpp>
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
#include <boost/python.hpp>
#include "mapnik_enumeration.hpp"
@@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
// mapnik
#include <mapnik/proj_transform.hpp>
+
// boost
#include <boost/python.hpp>
@@ -19,9 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
-//boost
+// boost
#include <boost/python.hpp>
// mapnik
@@ -19,11 +19,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
+// boost
#include <boost/python.hpp>
+
+// mapnik
#include <mapnik/query.hpp>
#include <mapnik/box2d.hpp>
+
using mapnik::query;
using mapnik::box2d;
@@ -19,10 +19,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
+// boost
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
+
+// mapnik
#include <mapnik/raster_colorizer.hpp>
using mapnik::raster_colorizer;
@@ -19,9 +19,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
+// boost
#include <boost/python.hpp>
+
+// mapnik
#include <mapnik/raster_symbolizer.hpp>
using mapnik::raster_symbolizer;
@@ -19,13 +19,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-//$Id$
+// boost
#include <boost/python.hpp>
#include <boost/python/implicit.hpp>
#include <boost/python/detail/api_placeholder.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
+// mapnik
#include <mapnik/rule.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/expression_string.hpp>
Oops, something went wrong.

0 comments on commit 1f351e0

Please sign in to comment.