Add logging

This commit is contained in:
Siu Kwan Lam 2013-01-22 11:50:06 -06:00
commit e39e1c7205
2 changed files with 10 additions and 4 deletions

View file

@ -1,5 +1,8 @@
import logging
from utils import *
logger = logging.getLogger(__name__)
_py2capi_fmtmap = {
str: 's#',
}

View file

@ -1,8 +1,11 @@
import sys
import sys, logging
from binding import *
from utils import *
from cStringIO import StringIO
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
extension_entry = '''
extern "C" {
@ -143,7 +146,6 @@ class Context(object):
println2('return capsule.wrap(ret)')
println('')
def add_module(self, module):
allsyms = [(k, v) for k, v in vars(module).items()
if isinstance(v, Binding)]
@ -159,6 +161,7 @@ class Context(object):
def println_to_def(s):
buf.write(s)
buf.write('\n')
logger.info('compiling %s', k)
v.compile(k, println_to_def)
self.definitions.append(buf.getvalue())
buf.close()
@ -200,11 +203,11 @@ if __name__ == '__main__':
outputfilename = sys.argv[1]
srcdir = sys.argv[2]
modnames = sys.argv[3:]
modules = []
for m in modnames:
path = '%s.%s' % (srcdir, m)
print path
logger.info("import module %s", path)
module = __import__(path)
for token in path.split('.')[1:]:
module = getattr(module, token)