Better logging
This commit is contained in:
@@ -105,13 +105,13 @@ def build(source, destination, debug=False, verbose=False, force=False,
|
||||
if destination:
|
||||
settings['destination'] = os.path.abspath(destination)
|
||||
|
||||
logger.debug("Input directory: '%s'", settings['source'])
|
||||
logger.info("Input : %s", settings['source'])
|
||||
if not settings['source'] or not os.path.isdir(settings['source']):
|
||||
logger.error("Input directory '%s' does not exist.",
|
||||
settings['source'])
|
||||
sys.exit(1)
|
||||
|
||||
logger.debug("Output directory: '%s'", settings['destination'])
|
||||
logger.info("Output : %s", settings['destination'])
|
||||
if not os.path.relpath(settings['destination'],
|
||||
settings['source']).startswith('..'):
|
||||
logger.error("Output directory should be outside of the input "
|
||||
|
||||
@@ -159,8 +159,6 @@ class Gallery(object):
|
||||
def build(self):
|
||||
"Create the image gallery"
|
||||
|
||||
self.logger.info("Generate gallery in %s ...",
|
||||
self.settings['destination'])
|
||||
check_or_create_dir(self.settings['destination'])
|
||||
|
||||
# Compute the label with for the progress bar. The max value is 48
|
||||
@@ -201,8 +199,10 @@ class Gallery(object):
|
||||
img_iterator = progress.bar(imglist, label=label)
|
||||
else:
|
||||
img_iterator = iter(imglist)
|
||||
self.logger.info("")
|
||||
self.logger.info(":: Processing '%s' [%i images]",
|
||||
colored.green(dirname), len(imglist))
|
||||
self.logger.info("")
|
||||
|
||||
try:
|
||||
# loop on images
|
||||
|
||||
@@ -89,7 +89,7 @@ def read_settings(filename=None):
|
||||
if path and not os.path.isabs(path):
|
||||
settings[p] = os.path.abspath(os.path.normpath(os.path.join(
|
||||
settings_path, path)))
|
||||
logger.debug("%s : %s -> %s", p, path, settings[p])
|
||||
logger.debug("Rewrite %s : %s -> %s", p, path, settings[p])
|
||||
|
||||
for key in ('img_size', 'thumb_size'):
|
||||
w, h = settings[key]
|
||||
|
||||
@@ -62,7 +62,7 @@ class Writer(object):
|
||||
if not os.path.exists(self.theme):
|
||||
raise Exception("Impossible to find the theme %s" % self.theme)
|
||||
|
||||
self.logger.info("Theme path : %s", self.theme)
|
||||
self.logger.info("Theme : %s", self.theme)
|
||||
theme_relpath = os.path.join(self.theme, 'templates')
|
||||
default_loader = FileSystemLoader(
|
||||
os.path.join(THEMES_PATH, 'default', 'templates'))
|
||||
|
||||
Reference in New Issue
Block a user