From 106a00efbdbaff555f546f1fe165957e78b67aa5 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 9 Apr 2014 18:19:05 +0200 Subject: [PATCH] Make SongbookBuilder.logger optional --- songbook_core/build.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/songbook_core/build.py b/songbook_core/build.py index 662dc0b6..31f65a6c 100644 --- a/songbook_core/build.py +++ b/songbook_core/build.py @@ -152,7 +152,7 @@ class SongbookBuilder(object): # are function; values are return values of functions. _called_functions = {} - def __init__(self, raw_songbook, basename, logger): + def __init__(self, raw_songbook, basename, logger=None): # Representation of the .sb songbook configuration file. self.songbook = Songbook(raw_songbook, basename) # Basename of the songbook to be built. @@ -237,7 +237,8 @@ class SongbookBuilder(object): """Make index""" sxd_files = glob.glob("%s_*.sxd" % self.basename) for sxd_file in sxd_files: - self.logger.info("processing " + sxd_file) + if self.logger: + self.logger.info("processing " + sxd_file) idx = process_sxd(sxd_file) with open(sxd_file[:-3] + "sbx", "w") as index_file: index_file.write(idx.entries_to_str().encode('utf8'))