Skip to content

Commit

Permalink
and use the logger we requested instead of logging on the root
Browse files Browse the repository at this point in the history
  • Loading branch information
f0rk committed Mar 4, 2016
1 parent 3441ca7 commit 40765e3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tzwhere/tzwhere.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def read_tzworld(input_kind='json', path=None):
def read_json(path=None):
if path is None:
path = tzwhere.DEFAULT_JSON
logging.info('Reading json input file: %s\n' % path)
LOGGER.info('Reading json input file: %s\n' % path)
with open(path, 'r') as f:
featureCollection = json.load(f)
return featureCollection
Expand All @@ -268,30 +268,30 @@ def read_json(path=None):
def read_pickle(path=None):
if path is None:
path = tzwhere.DEFAULT_PICKLE
logging.info('Reading pickle input file: %s\n' % path)
LOGGER.info('Reading pickle input file: %s\n' % path)
with open(path, 'rb') as f:
featureCollection = pickle.load(f)
return featureCollection

@staticmethod
def write_pickle(featureCollection, path=DEFAULT_PICKLE):
logging.info('Writing pickle output file: %s\n' % path)
LOGGER.info('Writing pickle output file: %s\n' % path)
with open(path, 'wb') as f:
pickle.dump(featureCollection, f, protocol=2)

@staticmethod
def _read_polygons_from_csv(path=None):
if path is None:
path = tzwhere.DEFAULT_CSV
logging.info('Reading from CSV input file: %s\n' % path)
LOGGER.info('Reading from CSV input file: %s\n' % path)
with open(path, 'r') as f:
for row in f:
row = row.split(',')
yield(row[0], [[float(y) for y in x.split(' ')] for x in row[1:]])

@staticmethod
def write_csv(featureCollection, path=DEFAULT_CSV):
logging.info('Writing csv output file: %s\n' % path)
LOGGER.info('Writing csv output file: %s\n' % path)
with open(path, 'w') as f:
writer = csv.writer(f)
for (tzname, polygon) in tzwhere._feature_collection_polygons(
Expand Down Expand Up @@ -366,7 +366,7 @@ def main():
import sys
sys.exit(1)

logging.info('Application started..')
LOGGER.info('Application started..')
args = docopt.docopt(HELP)

global report_memory
Expand Down

0 comments on commit 40765e3

Please sign in to comment.