diff flys-backend/contrib/shpimporter/hws.py @ 5006:769593a84606 dami

Importer: Behold, Logging!
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 15 Feb 2013 16:22:13 +0100
parents 563ff8893d47
children c5187ab9f571
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/hws.py	Fri Feb 15 16:19:52 2013 +0100
+++ b/flys-backend/contrib/shpimporter/hws.py	Fri Feb 15 16:22:13 2013 +0100
@@ -9,6 +9,9 @@
 from importer import Importer
 import utils
 
+import logging
+logger = logging.getLogger("Hochwasserschutzanlagen")
+
 PATH="Hydrologie/HW-Schutzanlagen"
 NAME="HWS"
 
@@ -93,7 +96,7 @@
             self.handled(artname)
             kind_id = HWS_KIND.get(feat.GetField(artname).lower())
             if not kind_id:
-                print ("Unknown Art: %s" % \
+                logger.warn("Unknown Art: %s" % \
                         feat.GetField(artname))
             else:
                 newFeat.SetField("kind_id", kind_id)
@@ -104,7 +107,7 @@
             fed_id = FED_STATES.get(feat.GetField(fname).lower())
 
             if not fed_id:
-                print ("Unknown Bundesland: %s" % \
+                logger.warn("Unknown Bundesland: %s" % \
                         feat.GetField("Bundesland"))
             else:
                 newFeat.SetField("fed_state_id", fed_id)
@@ -123,7 +126,7 @@
         if self.IsFieldSet(feat, fname):
             self.handled(fname)
             if feat.GetField(fname) != self.river_id:
-                print ("River_id mismatch between shapefile and"
+                logger.warn("River_id mismatch between shapefile and"
                      " importer parameter.")
             newFeat.SetField("river_id", feat.GetField(fname))
         else:

http://dive4elements.wald.intevation.org