From a986aedd057476702688b7a877ad671fe1bc1700 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 16 Aug 2012 15:52:32 -0700 Subject: [PATCH] remove 'info' and 'fatal' severities for logging to simplify framework - closes #1400 --- SConstruct | 4 +-- bindings/python/mapnik_logger.cpp | 8 ----- include/mapnik/debug.hpp | 37 ++++++---------------- include/mapnik/enumeration.hpp | 4 +-- include/mapnik/svg/svg_renderer.hpp | 1 - plugins/input/kismet/kismet_datasource.cpp | 4 +-- plugins/input/osm/osm_featureset.cpp | 5 +-- src/debug.cpp | 4 +-- tests/python_tests/mapnik_logger_test.py | 16 ++++++++++ 9 files changed, 36 insertions(+), 47 deletions(-) create mode 100644 tests/python_tests/mapnik_logger_test.py diff --git a/SConstruct b/SConstruct index 113dbde39..dd0296da8 100644 --- a/SConstruct +++ b/SConstruct @@ -33,6 +33,7 @@ except: HAS_DISTUTILS = False LIBDIR_SCHEMA_DEFAULT='lib' +severities = ['debug', 'warn', 'error', 'none'] py3 = None @@ -343,7 +344,7 @@ opts.AddVariables( # 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'), - ('DEFAULT_LOG_SEVERITY', 'The default severity of the logger (eg. "info", "debug", "warn", "error", "fatal", "none")', 'error'), + ('DEFAULT_LOG_SEVERITY', 'The default severity of the logger (eg. ' + ', '.join(severities), 'error'), # Other variables BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'), @@ -1470,7 +1471,6 @@ if not preconfigured: ndebug_flags = '-DNDEBUG' # Enable logging in debug mode (always) and release mode (when specified) - severities = ['info', 'debug', 'warn', 'error', 'fatal', 'none'] if env['DEFAULT_LOG_SEVERITY']: if env['DEFAULT_LOG_SEVERITY'] not in severities: severities_list = ', '.join(["'%s'" % s for s in severities]) diff --git a/bindings/python/mapnik_logger.cpp b/bindings/python/mapnik_logger.cpp index 257c6e510..0f3b30949 100644 --- a/bindings/python/mapnik_logger.cpp +++ b/bindings/python/mapnik_logger.cpp @@ -39,22 +39,14 @@ void export_logger() ; enum_("severity_type") - .value("Info", logger::info) .value("Debug", logger::debug) .value("Warn", logger::warn) .value("Error", logger::error) - .value("Fatal", logger::fatal) .value("None", logger::none) ; class_ >, boost::noncopyable>("logger",no_init) - .def_readonly("Info", logger::info) - .def_readonly("Debug", logger::debug) - .def_readonly("Warn", logger::warn) - .def_readonly("Error", logger::error) - .def_readonly("Fatal", logger::fatal) - .def_readonly("None", logger::none) .def("get_severity", &logger::get_severity) .def("set_severity", &logger::set_severity) .def("get_object_severity", &logger::get_object_severity) diff --git a/include/mapnik/debug.hpp b/include/mapnik/debug.hpp index 874c162b5..105bfe103 100644 --- a/include/mapnik/debug.hpp +++ b/include/mapnik/debug.hpp @@ -55,12 +55,10 @@ namespace mapnik { public: enum severity_type { - info, - debug, - warn, - error, - fatal, - none + debug = 0, + warn = 1, + error = 2 + none = 3 }; typedef boost::unordered_map severity_map; @@ -180,7 +178,7 @@ namespace mapnik { /* Base log class, should not log anything when no MAPNIK_LOG is defined - This is used for info/debug/warn reporting that should not output + This is used for debug/warn reporting that should not output anything when not compiling for speed. */ template