Mercurial > piecrust2
comparison piecrust/chefutil.py @ 120:133845647083
Better error management and removal support in baking/processing.
* Baker and processor pipeline now store errors in their records.
* They also support deleting output files that are no longer valid.
* The basic transitional record class implements more boilerplate code.
* The processor pipeline is run from the `bake` command directly.
* New unit tests.
* Unit test mocking now mocks `os.remove` too.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 09 Nov 2014 14:46:23 -0800 |
parents | 8703be118430 |
children | a561fbad0b7f |
comparison
equal
deleted
inserted
replaced
119:0811f92cbdc7 | 120:133845647083 |
---|---|
1 import time | 1 import time |
2 from colorama import Fore | 2 from colorama import Fore |
3 | 3 |
4 | 4 |
5 def format_timed(start_time, message, colored=True): | 5 def format_timed(start_time, message, indent_level=0, colored=True): |
6 end_time = time.clock() | 6 end_time = time.clock() |
7 indent = indent_level * ' ' | |
7 time_str = '%8.1f ms' % ((end_time - start_time) * 1000.0) | 8 time_str = '%8.1f ms' % ((end_time - start_time) * 1000.0) |
8 if colored: | 9 if colored: |
9 return '[%s%s%s] %s' % (Fore.GREEN, time_str, Fore.RESET, message) | 10 return '[%s%s%s] %s' % (Fore.GREEN, time_str, Fore.RESET, message) |
10 return '[%s] %s' % (time_str, message) | 11 return '%s[%s] %s' % (indent, time_str, message) |
11 | 12 |
12 | 13 |
13 def log_friendly_exception(logger, ex): | 14 def log_friendly_exception(logger, ex): |
14 indent = '' | 15 indent = '' |
15 while ex: | 16 while ex: |