fysm-4-1space-accessstablestagetest-hooks
Last change
on this file since ed938ef was
1f94b84,
checked in by Alex Dehnert <adehnert@…>, 15 years ago
|
Add log_and_ignore_failures decorator
|
-
Property mode set to
100644
|
File size:
359 bytes
|
Rev | Line | |
---|
[1f94b84] | 1 | import traceback |
---|
| 2 | |
---|
| 3 | def log_and_ignore_failures(logfile): |
---|
| 4 | def decorator(f): |
---|
| 5 | def new_f(*args, **kwargs): |
---|
| 6 | try: |
---|
| 7 | return f(*args, **kwargs) |
---|
| 8 | except Exception: |
---|
| 9 | fd = open(logfile, 'a') |
---|
| 10 | traceback.print_exc(file=fd, ) |
---|
| 11 | fd.close() |
---|
| 12 | return new_f |
---|
| 13 | return decorator |
---|
Note: See
TracBrowser
for help on using the repository browser.