aboutsummaryrefslogtreecommitdiff
path: root/music_sampler/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'music_sampler/helpers.py')
-rw-r--r--music_sampler/helpers.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/music_sampler/helpers.py b/music_sampler/helpers.py
index 943e5a1..9403875 100644
--- a/music_sampler/helpers.py
+++ b/music_sampler/helpers.py
@@ -214,6 +214,15 @@ def parse_args():
214 if not Config.music_path.endswith("/"): 214 if not Config.music_path.endswith("/"):
215 Config.music_path = Config.music_path + "/" 215 Config.music_path = Config.music_path + "/"
216 216
217def dump_config():
218 max_size = max(max(map(len, Configs_order)), len('config'))
219 info_print("{:<{}} : {}".format(
220 "config", max_size, Config.yml_file))
221 for item in Config.__dict__:
222 if item in Configs_order:
223 info_print("{:<{}} : {}".format(
224 item, max_size, getattr(Config, item)))
225
217def build_config(args): 226def build_config(args):
218 stream = open(Config.yml_file, "r") 227 stream = open(Config.yml_file, "r")
219 try: 228 try:
@@ -297,3 +306,10 @@ def warn_print(message, with_trace=None):
297 306
298 Logger.warn('MusicSampler: ' + message, exc_info=with_trace) 307 Logger.warn('MusicSampler: ' + message, exc_info=with_trace)
299 308
309def info_print(message, with_trace=None):
310 if with_trace is None:
311 with_trace = (Logger.getEffectiveLevel() < logging.WARN)
312 with_trace &= (sys.exc_info()[0] is not None)
313
314 Logger.info('MusicSampler: ' + message, exc_info=with_trace)
315