Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Better log messages #104

Merged
merged 3 commits into from

1 participant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2013
  1. Unneeded

    authored
  2. Better log messages

    authored
This page is out of date. Refresh to see the latest.
View
4 tilecloud_chain/__init__.py
@@ -107,6 +107,8 @@ class TileGeneration:
def __init__(self, config_file, options=None, layer_name=None):
level = logging.WARNING
+ if options and options.verbose and options.debug:
+ exit("Debug and verbose options can't be used together")
if options and options.verbose:
level = logging.INFO
elif options and options.debug:
@@ -570,7 +572,7 @@ def init_geom(self, extent=None):
conn = psycopg2.connect(self.layer['connection'])
cursor = conn.cursor()
sql = 'SELECT ST_AsBinary(geom) FROM (SELECT %s) AS g' % self.layer['sql']
- logger.debug('Execute SQL: %s.' % sql)
+ logger.info('Execute SQL: %s.' % sql)
cursor.execute(sql)
geoms = [loads_wkb(str(r[0])) for r in cursor.fetchall()]
self.geom = cascaded_union(geoms)
View
9 tilecloud_chain/generate.py
@@ -58,8 +58,7 @@ def _gene(options, gene, layer):
gene.set_tilecoords([TileCoord(z, x, y)])
# At this stage, the tilestream contains metatiles that intersect geometry
- if options.test > 0 or options.verbose:
- gene.imap(Logger(logger, logging.INFO, '%(tilecoord)s'))
+ gene.imap(Logger(logger, logging.INFO, '%(tilecoord)s'))
if options.role == 'master': # pragma: no cover
# Put the metatiles into the SQS queue
@@ -109,7 +108,7 @@ def _gene(options, gene, layer):
gene.add_error_filters(logger)
# Discard tiles with certain content
- if meta and 'empty_metatile_detection' in gene.layer:
+ if 'empty_metatile_detection' in gene.layer:
empty_tile = gene.layer['empty_metatile_detection']
gene.imap(HashDropper(
empty_tile['size'], empty_tile['hash'], store=cache_tilestore,
@@ -125,6 +124,7 @@ def add_elapsed_togenerate(metatile):
# Split the metatile image into individual tiles
gene.add_metatile_splitter()
+ gene.imap(Logger(logger, logging.INFO, '%(tilecoord)s'))
if options.role == 'hash':
gene.imap(HashLogger('empty_tile_detection'))
@@ -138,9 +138,6 @@ def add_elapsed_togenerate(metatile):
))
if options.role in ('local', 'slave'):
- if options.test > 0 or options.verbose:
- gene.imap(Logger(logger, logging.DEBUG, '%(tilecoord)s'))
-
gene.add_error_filters(logger)
gene.ifilter(DropEmpty())
View
2  tilecloud_chain/tests/test_error.py
@@ -67,7 +67,7 @@ def test_zoom_errors(self, l):
'./buildout/bin/generate_tiles -c tilegeneration/test.yaml -l point --zoom 4,10',
generate.main)
l.check(
- ('tilecloud_chain', 'DEBUG', 'Execute SQL: SELECT ST_AsBinary(geom) FROM (SELECT the_geom AS geom '
+ ('tilecloud_chain', 'INFO', 'Execute SQL: SELECT ST_AsBinary(geom) FROM (SELECT the_geom AS geom '
'FROM tests.point) AS g.'),
('tilecloud_chain', 'WARNING', "Warning: zoom 10 is greater than the maximum "
"zoom 4 of grid swissgrid_5 of layer point, ignored."),
Something went wrong with that request. Please try again.