Adjust hooke.playlist to allow spaces in .info keys.
[hooke.git] / hooke / hooke.py
index 6b4975738849b45fb0d89e3c525d5652f6e376f9..d1c3b9c7a9fd4d4a93e3294ae3bda41f705b2bfd 100644 (file)
@@ -54,10 +54,13 @@ if False: # Queue pickle error debugging code
         feed(buffer, notempty, s, writelock, close)
     multiprocessing.queues.Queue._feed = staticmethod(new_feed)
 
+import logging
+import logging.config
 import multiprocessing
 import optparse
 import os.path
 import unittest
+import StringIO
 import sys
 
 from . import engine as engine
@@ -81,13 +84,21 @@ class Hooke (object):
                 default_settings=default_settings)
             config.read()
         self.config = config
+        self.load_log()
         self.load_plugins()
         self.load_drivers()
         self.load_ui()
         self.command = engine.CommandEngine()
-
         self.playlists = playlist.NoteIndexList()
 
+    def load_log(self):
+        config_file = StringIO.StringIO()
+        self.config.write(config_file)
+        logging.config.fileConfig(StringIO.StringIO(config_file.getvalue()))
+        # Don't attach the logger because it contains an unpicklable
+        # thread.lock.  Instead, grab it directly every time you need it.
+        #self.log = logging.getLogger('hooke')
+
     def load_plugins(self):
         self.plugins = plugin_mod.load_graph(
             plugin_mod.PLUGIN_GRAPH, self.config, include_section='plugins')