Log instead of print
This commit is contained in:
parent
01a9392fc1
commit
9c9323b170
@ -35,6 +35,10 @@ def cli_main():
|
|||||||
|
|
||||||
from blender_asset_tracer import __version__
|
from blender_asset_tracer import __version__
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# Make sure the things we log in our local logger are visible
|
||||||
|
if args.profile and args.loglevel > logging.INFO:
|
||||||
|
log.setLevel(logging.INFO)
|
||||||
log.debug('Running BAT version %s', __version__)
|
log.debug('Running BAT version %s', __version__)
|
||||||
|
|
||||||
if not args.func:
|
if not args.func:
|
||||||
@ -45,12 +49,13 @@ def cli_main():
|
|||||||
import cProfile
|
import cProfile
|
||||||
|
|
||||||
prof_fname = 'bam.prof'
|
prof_fname = 'bam.prof'
|
||||||
|
log.info('Running profiler')
|
||||||
cProfile.runctx('args.func(args)',
|
cProfile.runctx('args.func(args)',
|
||||||
globals=globals(),
|
globals=globals(),
|
||||||
locals=locals(),
|
locals=locals(),
|
||||||
filename=prof_fname)
|
filename=prof_fname)
|
||||||
print('Profiler exported data to', prof_fname)
|
log.info('Profiler exported data to %s', prof_fname)
|
||||||
print('Run "pyprof2calltree -i %r -k" to convert and open in KCacheGrind' % prof_fname)
|
log.info('Run "pyprof2calltree -i %r -k" to convert and open in KCacheGrind', prof_fname)
|
||||||
else:
|
else:
|
||||||
retval = args.func(args)
|
retval = args.func(args)
|
||||||
duration = datetime.timedelta(seconds=time.time() - start_time)
|
duration = datetime.timedelta(seconds=time.time() - start_time)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user