Log execution debug messages from the commandline UI (matching the GUI).
authorW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 19:42:35 +0000 (15:42 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 19:42:35 +0000 (15:42 -0400)
hooke/ui/commandline.py

index 4533217222eb467bab441d29e1f62f6ff210f121..53291a25e1a4df2420fb0f43dcfbf1e1302d8b61 100644 (file)
@@ -22,6 +22,7 @@ line.
 
 import codecs
 import cmd
+import logging
 import optparse
 try:
     import readline # including readline makes cmd.Cmd.cmdloop() smarter
@@ -118,6 +119,7 @@ class DoCommand (CommandMethod):
     def __init__(self, *args, **kwargs):
         super(DoCommand, self).__init__(*args, **kwargs)
         self.parser = CommandLineParser(self.command, self.name_fn)
+        self.log = logging.getLogger('hooke')
 
     def __call__(self, args):
         try:
@@ -126,7 +128,7 @@ class DoCommand (CommandMethod):
             self.cmd.stdout.write(str(e).lstrip()+'\n')
             self.cmd.stdout.write('Failure\n')
             return
-        print args
+        self.log.debug('executing %s with %s' % (self.command.name, args))
         self.cmd.inqueue.put(CommandMessage(self.command, args))
         while True:
             msg = self.cmd.outqueue.get()