Add more logging with file prefixes
This makes the handoff between gendoc and batesian clearer in the logs.
This commit is contained in:
parent
064a2c9172
commit
f1adad5fb3
4 changed files with 15 additions and 14 deletions
|
@ -253,14 +253,13 @@ def run_through_template(input):
|
|||
]
|
||||
if VERBOSE:
|
||||
args.insert(2, "-v")
|
||||
log("EXEC: %s" % " ".join(args))
|
||||
log(" ==== build.py output ==== ")
|
||||
log(
|
||||
subprocess.check_output(
|
||||
print subprocess.check_output(
|
||||
args,
|
||||
stderr=out,
|
||||
cwd="../templating"
|
||||
)
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
with open(tmpfile, 'r') as f:
|
||||
sys.stderr.write(f.read() + "\n")
|
||||
|
|
|
@ -16,7 +16,7 @@ class Sections(object):
|
|||
|
||||
def log(self, text):
|
||||
if self.debug:
|
||||
print text
|
||||
print "batesian:sections: %s" % text
|
||||
|
||||
def get_sections(self):
|
||||
render_list = inspect.getmembers(self, predicate=inspect.ismethod)
|
||||
|
|
|
@ -22,7 +22,7 @@ class Units(object):
|
|||
|
||||
def log(self, text):
|
||||
if self.debug:
|
||||
print text
|
||||
print "batesian:units: %s" % text
|
||||
|
||||
def get_units(self, debug=False):
|
||||
unit_list = inspect.getmembers(self, predicate=inspect.ismethod)
|
||||
|
|
|
@ -52,8 +52,8 @@ def create_from_template(template, sections):
|
|||
def check_unaccessed(name, store):
|
||||
unaccessed_keys = store.get_unaccessed_set()
|
||||
if len(unaccessed_keys) > 0:
|
||||
print "Found %s unused %s keys." % (len(unaccessed_keys), name)
|
||||
print unaccessed_keys
|
||||
log("Found %s unused %s keys." % (len(unaccessed_keys), name))
|
||||
log(unaccessed_keys)
|
||||
|
||||
def main(input_module, file_stream=None, out_dir=None, verbose=False):
|
||||
if out_dir and not os.path.exists(out_dir):
|
||||
|
@ -121,17 +121,19 @@ def main(input_module, file_stream=None, out_dir=None, verbose=False):
|
|||
return
|
||||
|
||||
# check the input files and substitute in sections where required
|
||||
print "Parsing input template: %s" % file_stream.name
|
||||
log("Parsing input template: %s" % file_stream.name)
|
||||
temp = Template(file_stream.read())
|
||||
print "Creating output for: %s" % file_stream.name
|
||||
log("Creating output for: %s" % file_stream.name)
|
||||
output = create_from_template(temp, sections)
|
||||
with open(
|
||||
os.path.join(out_dir, os.path.basename(file_stream.name)), "w"
|
||||
) as f:
|
||||
f.write(output)
|
||||
print "Output file for: %s" % file_stream.name
|
||||
log("Output file for: %s" % file_stream.name)
|
||||
check_unaccessed("units", units)
|
||||
|
||||
def log(line):
|
||||
print "batesian: %s" % line
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = ArgumentParser(
|
||||
|
@ -175,7 +177,7 @@ if __name__ == '__main__':
|
|||
sys.exit(0)
|
||||
|
||||
if not args.file:
|
||||
print "No file supplied."
|
||||
log("No file supplied.")
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue