Commit f4577f39 authored by Thomas Albrecht's avatar Thomas Albrecht

cleaned up logging message

parent 78e547fd
......@@ -105,7 +105,7 @@ def check_height(building_height, t):
if building_height >= t.v_cuts_meters[0] and building_height <= t.v_size_meters:
# print "--->"
if t.v_align_bottom or parameters.BUILDING_FAKE_AMBIENT_OCCLUSION:
logging.debug("from bottom")
logging.verbose("from bottom")
for i in range(len(t.v_cuts_meters)):
if t.v_cuts_meters[i] >= building_height:
# print "bot trying %g >= %g ?" % (t.v_cuts_meters[i], building_height)
......@@ -479,7 +479,7 @@ def analyse(buildings, static_objects, transform, elev, facades, roofs):
pass
#
# -- determine facade and roof textures
logging.debug("___find facade")
logging.verbose("___find facade")
if b.parent is None:
b.facade_texture = facades.find_matching(facade_requires, b.tags, b.height, b.longest_edge_len)
else:
......@@ -490,7 +490,7 @@ def analyse(buildings, static_objects, transform, elev, facades, roofs):
b.parent.facade_texture = b.facade_texture
else:
b.facade_texture = b.parent.facade_texture
logging.debug("__done" + str(b.facade_texture))
logging.verbose("__done" + str(b.facade_texture))
if not b.facade_texture:
tools.stats.skipped_texture += 1
logging.info("Skipping building (no matching texture)")
......
......@@ -576,7 +576,7 @@ if __name__ == "__main__":
args = parser.parse_args()
# -- command line args override paramters
parameters.set_loglevel(args)
parameters.set_loglevel(args.loglevel)
if args.filename is not None:
parameters.read_from_file(args.filename)
......
......@@ -846,8 +846,13 @@ def main():
help="read parameters from FILE (e.g. params.ini)", metavar="FILE")
parser.add_argument("-e", dest="e", action="store_true", help="skip elevation interpolation")
parser.add_argument("-b", "--bridges-only", action="store_true", help="create only bridges and embankments")
parser.add_argument("-l", "--loglevel", help="set loglevel. Valid levels are DEBUG, INFO, WARNING, ERROR, CRITICAL")
args = parser.parse_args()
# -- command line args override paramters
parameters.set_loglevel(args.loglevel)
if args.filename is not None:
parameters.read_from_file(args.filename)
......
......@@ -44,7 +44,7 @@ def flat(out, b, X, ac_name=""):
# |/ | draw 0 - 4 5 6 7 4 - 0 1 2 - 8 9 10 11 8 - 2 3
# 0---->>-----------1
logging.debug("FIXME: check if we duplicate nodes, and if separate model still makes sense.")
logging.verbose("FIXME: check if we duplicate nodes, and if separate model still makes sense.")
if ac_name:
out.new_object(ac_name, b.roof_texture.filename + '.png')
......
......@@ -48,7 +48,7 @@ class Atlas(Region):
try:
atlas.paste(the_image, (the_texture._x, the_texture._y))
except ValueError:
logging.info("%s: Skipping an empty texture" % self.name)
logging.debug("%s: Skipping an empty texture" % self.name)
atlas.save(filename, optimize=True)
def pack(self, the_texture):
......
......@@ -215,9 +215,9 @@ class TextureManager(object):
def find_matching(self, requires = []):
candidates = self.find_candidates(requires)
logging.debug("looking for texture" + str(requires))
logging.verbose("looking for texture" + str(requires))
for c in candidates:
logging.debug(" candidate " + c.filename + " provides " + str(c.provides))
logging.verbose(" candidate " + c.filename + " provides " + str(c.provides))
if len(candidates) == 0:
logging.warn("WARNING: no matching texture for <%s>" % str(requires))
return None
......@@ -234,7 +234,7 @@ class TextureManager(object):
if set(requires).issubset(cand.provides):
candidates.append(cand)
else:
logging.debug(" unmet requires %s" % str(cand))
logging.verbose(" unmet requires %s" % str(cand))
return candidates
def __str__(self):
......@@ -310,13 +310,13 @@ def find_matching_texture(cls, textures):
# pitched roof: requires = facade:age:old
def init(tex_prefix='', create_atlas=False):
print "textures: init"
logging.debug("textures: init")
global facades
global roofs
filename = tex_prefix + 'tex/atlas_facades'
pkl_fname = filename + '.pkl'
if create_atlas:
facades = FacadeManager('facade')
roofs = TextureManager('roof')
......@@ -362,7 +362,7 @@ def init(tex_prefix='', create_atlas=False):
roofs = cPickle.load(fpickle)
fpickle.close()
logging.info(facades)
logging.debug(facades)
if __name__ == "__main__":
......
......@@ -81,8 +81,8 @@ class Texture(object):
self.h_size_meters = h_size_meters
else:
self.h_size_meters = self.v_size_meters / image_aspect
print "No hsize, using image aspect %i x %i = %g. h_size = %g v_size = %g" % \
(self.width_px, self.height_px, image_aspect, self.h_size_meters, self.v_size_meters)
logging.debug("No hsize, using image aspect %i x %i = %g. h_size = %g v_size = %g" % \
(self.width_px, self.height_px, image_aspect, self.h_size_meters, self.v_size_meters))
# aspect = v / h
if v_cuts == []:
......
......@@ -677,6 +677,7 @@ class Stats(object):
self.textures_used.add(str(texture))
def print_summary(self):
if parameters.quiet: return
out = sys.stdout
total_written = self.LOD.sum()
lodzero = 0
......@@ -748,7 +749,7 @@ def install_files(file_list, dst):
"""link files in file_list to dst"""
for the_file in file_list:
the_dst = dst + os.sep + the_file
print "cp %s %s" % (the_file, the_dst)
logging.info("cp %s %s" % (the_file, the_dst))
try:
shutil.copy2(the_file, the_dst)
except OSError, reason:
......@@ -766,7 +767,7 @@ def get_interpolator(**kwargs):
def progress(i, max_i):
"""progress indicator"""
if sys.stdout.isatty():
if sys.stdout.isatty() and not parameters.quiet:
try:
if i % (max_i / 100) > 0:
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment