aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--music_sampler/helpers.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/music_sampler/helpers.py b/music_sampler/helpers.py
index 1788084..68c1328 100644
--- a/music_sampler/helpers.py
+++ b/music_sampler/helpers.py
@@ -5,6 +5,7 @@ import os
5import math 5import math
6import sounddevice as sd 6import sounddevice as sd
7import logging 7import logging
8Logger = logging.getLogger("kivy")
8 9
9from . import sysfont 10from . import sysfont
10 11
@@ -59,6 +60,11 @@ def parse_args():
59 60
60 sys.argv.extend(kivy_args) 61 sys.argv.extend(kivy_args)
61 62
63 os.environ["KIVY_NO_CONFIG"] = 'true'
64 sys.argv.extend(["-c", "kivy:log_level:warning"])
65 sys.argv.extend(["-c", "kivy:log_dir:/tmp"])
66 sys.argv.extend(["-c", "kivy:log_name:/tmp/music_sampler_%_.txt"])
67
62 parser = argparse.ArgumentParser( 68 parser = argparse.ArgumentParser(
63 description="A Music Sampler application.", 69 description="A Music Sampler application.",
64 formatter_class=argparse.ArgumentDefaultsHelpFormatter) 70 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
@@ -122,9 +128,6 @@ def parse_args():
122 help="Kivy arguments. All arguments after this are interpreted\ 128 help="Kivy arguments. All arguments after this are interpreted\
123 by Kivy. Pass \"-- --help\" to get Kivy's usage.") 129 by Kivy. Pass \"-- --help\" to get Kivy's usage.")
124 130
125 from kivy.logger import Logger
126 Logger.setLevel(logging.WARN)
127
128 args = parser.parse_args(argv) 131 args = parser.parse_args(argv)
129 132
130 Config.yml_file = args.config 133 Config.yml_file = args.config
@@ -142,8 +145,7 @@ def parse_args():
142 145
143class DebugModeAction(argparse.Action): 146class DebugModeAction(argparse.Action):
144 def __call__(self, parser, namespace, values, option_string=None): 147 def __call__(self, parser, namespace, values, option_string=None):
145 from kivy.logger import Logger 148 sys.argv.extend(["-c", "kivy:log_level:debug"])
146 Logger.setLevel(logging.DEBUG)
147 149
148class SelectDeviceAction(argparse.Action): 150class SelectDeviceAction(argparse.Action):
149 def __call__(self, parser, namespace, values, option_string=None): 151 def __call__(self, parser, namespace, values, option_string=None):
@@ -179,14 +181,11 @@ def gain(volume, old_volume=None):
179 max(volume, 0)] 181 max(volume, 0)]
180 182
181def debug_print(message, with_trace=False): 183def debug_print(message, with_trace=False):
182 from kivy.logger import Logger
183 Logger.debug('MusicSampler: ' + message, exc_info=with_trace) 184 Logger.debug('MusicSampler: ' + message, exc_info=with_trace)
184 185
185def error_print(message, with_trace=False): 186def error_print(message, with_trace=False):
186 from kivy.logger import Logger
187 Logger.error('MusicSampler: ' + message, exc_info=with_trace) 187 Logger.error('MusicSampler: ' + message, exc_info=with_trace)
188 188
189def warn_print(message, with_trace=False): 189def warn_print(message, with_trace=False):
190 from kivy.logger import Logger
191 Logger.warn('MusicSampler: ' + message, exc_info=with_trace) 190 Logger.warn('MusicSampler: ' + message, exc_info=with_trace)
192 191