Commits

Rhys ! committed 3028125

now using logging instead of print statements

  • Participants
  • Parent commits 616643c

Comments (0)

Files changed (2)

itsuki/converter.py

 from __future__ import with_statement
 
-import shpaml, subprocess, errno
+import errno, logging, shpaml, subprocess
 from fnmatch import filter
 from os import path, walk, stat, makedirs
 from stat import ST_MTIME
     def __init__(self, root, to_con=(), js_amalgamations={}, sass=True,
         shpaml=True, closure=True):
 
+        self.log = logging.getLogger('itsuki')
+
         self.closure_jar = path.join(path.dirname(path.realpath(__file__)), 'compiler.jar')
         self.root = root
         self.js_amalgamations = js_amalgamations
         mkdir_p(path.dirname(tmpl))
         with open(tmpl, 'w') as f:
             f.write(out)
-        print 'Updated: %s and %s' % (fname, tmpl)
+        self.log.info('Updated: %s and %s' % (fname, tmpl))
 
     def convert_sass(self, fname, css):
-        subprocess.call(['sass', '--style', 'compressed', '--update', fname + ':' + css])
-        print 'Updated: %s and %s' % (fname, css)
+        subprocess.call(['sass', '-q', '--style', 'compressed', '--update', fname + ':' + css])
+        self.log.info('Updated: %s and %s' % (fname, css))
 
     def convert_js(self, fname, js):
         for outf, infs in self.js_amalgamations.iteritems():
                         args.extend(['--js', f])
                     args.extend(['--create_source_map', outf + '.map', '--js_output_file', outf])
                     subprocess.call(args)
-                    print 'Updated: %s (amalgamation)' % outf
+                    self.log.info('Updated: %s (amalgamation)' % outf)
                 return
         mkdir_p(path.dirname(js))
         subprocess.call(['java', '-jar', self.closure_jar, '--js', fname, '--create_source_map', js + '.map', '--js_output_file', js])
-        print 'Updated: %s and %s' % (fname, js)
+        self.log.info('Updated: %s and %s' % (fname, js))
 
     def compiled_path(self, p, ext):
         return path.join(path.dirname(p), 'compiled', path.splitext(path.basename(p))[0] + ext)

itsuki/monitor.py

-import pyinotify
+import logging, pyinotify
 from fnmatch import fnmatch
 from os import remove, path
 
 class EventHandler(pyinotify.ProcessEvent):
     def __init__(self, conv):
         self.conv = conv
+        self.log = logging.getLogger('itsuki')
         pyinotify.ProcessEvent.__init__(self)
 
     def matches_pattern(self, pathname):
             try:
                 remove(f)
             except OSError:
-                print 'Removed: %s (no equiv)' % fname
+                self.log.info('Removed: %s (no equiv)' % fname)
             else:
-                print 'Removed: %s and %s' % (fname, f)
+                self.log.info('Removed: %s and %s' % (fname, f))
 
     def process_IN_CREATE(self, event):
         t = self.matches_pattern(event.pathname)