Skip to content

Commit ff28b24

Browse files
committed
Switch to named logger
Fixes #240
1 parent af72271 commit ff28b24

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

changelog.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ VERSION 2.X.X
99
Improvements:
1010
* Simplified setup and deployment (@mwtoews)
1111
* Faster shape access when missing shx file
12+
* Switch to named logger (see #240)
1213

1314
Bug fixes:
1415
* More robust handling of corrupt shapefiles (fixes #235)

shapefile.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
from datetime import date
2121
import zipfile
2222

23+
# Create named logger
24+
logger = logging.getLogger(__name__)
25+
2326

2427
# Module settings
2528
VERBOSE = True
@@ -568,13 +571,13 @@ def __geo_interface__(self):
568571
but the Shape contained interior holes (defined by counter-clockwise orientation in the shapefile format) that were \
569572
orphaned, i.e. not contained by any exterior rings. The rings were still included but were \
570573
encoded as GeoJSON exterior rings instead of holes.'
571-
logging.warning(msg)
574+
logger.warning(msg)
572575
only_holes = self._errors.get('polygon_only_holes', None)
573576
if only_holes:
574577
msg = header + 'Shapefile format requires that polygons contain at least one exterior ring, \
575578
but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were \
576579
still included but were encoded as GeoJSON exterior rings instead of holes.'
577-
logging.warning(msg)
580+
logger.warning(msg)
578581

579582
# return as geojson
580583
if len(polys) == 1:
@@ -904,7 +907,7 @@ class ShapefileException(Exception):
904907
# if len(messages) > 1:
905908
# # more than just the "Summary of..." header
906909
# msg = '\n'.join(messages)
907-
# logging.warning(msg)
910+
# logger.warning(msg)
908911

909912
class Reader(object):
910913
"""Reads the three files of a shapefile as a unit or

0 commit comments

Comments
 (0)