Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_logging.py: 100%
23 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
1from casatasks import casalog as _clog
2from datetime import datetime as _time
3import casatasks
4import os
6def start_log( tname, arguments ):
7 spaces = ' '*(18-len(tname))
8 start_time = str(_time.now())
9 _clog.origin(tname)
10 _clog.post( '##########################################' )
11 _clog.post( '##### Begin Task: ' + tname + spaces + ' #####' )
12 _clog.post( '%s( %s )' % ( tname, ', '.join(arguments) ))
13 return start_time,
15def end_log( state, tname, result ):
16 spaces = ' '*(18-len(tname))
17 end_time = str(_time.now())
18 _clog.origin(tname)
19 _clog.post( 'Result {}: {}'.format(tname, repr(result)), priority='DEBUG')
20 _clog.post( 'Task ' + tname + ' complete. Start time: ' + state[0] + ' End time: ' + end_time )
21 _clog.post( '##### End Task: ' + tname + ' ' + spaces + ' #####' )
22 _clog.post( '##########################################' )
23 return result
25def except_log(tname, exc):
26 _clog.post('Task {} raised an exception of class {} with the following message: {}'.
27 format(tname, type(exc).__name__, exc) ,'ERROR')