You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
554 B
Python
28 lines
554 B
Python
#!/usr/bin/env python3.6
|
|
# coding=utf-8
|
|
import json
|
|
|
|
from qutescript import qutescript
|
|
from qutescript.cli import parser
|
|
|
|
|
|
class KaboomError(Exception):
|
|
pass
|
|
|
|
|
|
parser.add_argument('--kaboom', action='store_true', help='Make things explode.')
|
|
|
|
|
|
@qutescript
|
|
def dump_to_log(request):
|
|
args = parser.parse_args()
|
|
if args.kaboom:
|
|
raise KaboomError('Oh noes!')
|
|
with open('qutescript.debug.log', 'a') as logfile:
|
|
line = json.dumps(request.dump())
|
|
logfile.writelines([line])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
dump_to_log()
|