mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-07-20 09:56:45 +00:00
updating
This commit is contained in:
parent
3c72f73323
commit
f465d2d025
2 changed files with 53 additions and 11 deletions
32
.idea/workspace.xml
generated
Normal file
32
.idea/workspace.xml
generated
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="a6ce10d4-c4cf-4d3e-a399-1dd8833312f0" name="Default Changelist" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectId" id="1lCCJOTpl4dM73bFodhMevjqqPE" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="a6ce10d4-c4cf-4d3e-a399-1dd8833312f0" name="Default Changelist" comment="" />
|
||||
<created>1607091614772</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1607091614772</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -325,7 +325,7 @@ class Tracer:
|
|||
elapsed_time_string = pycompat.timedelta_format(duration)
|
||||
indent = ' ' * 4 * (thread_global.depth + 1)
|
||||
self.write(
|
||||
'{indent}Elapsed time: {elapsed_time_string}'.format(**locals())
|
||||
'\033[33m'+'{indent}Elapsed time: {elapsed_time_string}'+'\033[0m'.format(**locals())
|
||||
)
|
||||
# #
|
||||
### Finished writing elapsed time. ####################################
|
||||
|
|
@ -397,7 +397,7 @@ class Tracer:
|
|||
source_path, source = get_path_and_source_from_frame(frame)
|
||||
source_path = source_path if not self.normalize else os.path.basename(source_path)
|
||||
if self.last_source_path != source_path:
|
||||
self.write(u'{indent}Source path:... {source_path}'.
|
||||
self.write('\033[33m' + u'{indent}Source path:... {source_path}' + '\033[0m'.
|
||||
format(**locals()))
|
||||
self.last_source_path = source_path
|
||||
source_line = source[line_no - 1]
|
||||
|
|
@ -426,11 +426,16 @@ class Tracer:
|
|||
|
||||
for name, value_repr in local_reprs.items():
|
||||
if name not in old_local_reprs:
|
||||
self.write('{indent}{newish_string}{name} = {value_repr}'.format(
|
||||
**locals()))
|
||||
str = '{indent}{newish_string}{name} = {value_repr}'.format( **locals())
|
||||
idx = str.find(":")
|
||||
if("Start" in str):
|
||||
self.write('\033[33m' + str[0:idx+3] + '\033[34m' + str[idx+3:] + '\033[0m')
|
||||
else:
|
||||
self.write('\033[33m' + str[0:idx+8] + '\033[34m' + str[idx+8:] + '\033[0m')
|
||||
elif old_local_reprs[name] != value_repr:
|
||||
self.write('{indent}Modified var:.. {name} = {value_repr}'.format(
|
||||
**locals()))
|
||||
str = '{indent}Modified var:.. {name} = {value_repr}'.format(**locals())
|
||||
idx = str.find("..")
|
||||
self.write('\033[33m' + str[0:idx+2] + '\033[34m' + str[idx+2:] + '\033[0m')
|
||||
|
||||
# #
|
||||
### Finished newish and modified variables. ###########################
|
||||
|
|
@ -474,9 +479,14 @@ class Tracer:
|
|||
self.write('{indent}Call ended by exception'.
|
||||
format(**locals()))
|
||||
else:
|
||||
self.write(u'{indent}{timestamp} {thread_info}{event:9} '
|
||||
u'{line_no:4} {source_line}'.format(**locals()))
|
||||
# If meets return, write Return value of return_value_repr.
|
||||
str = u'{indent}{timestamp} {thread_info}{event:9} 'u'{line_no:4} {source_line}'.format(**locals())
|
||||
idx = str.find(" ")
|
||||
|
||||
for s in str.split():
|
||||
if(s.isdigit()): num = s
|
||||
numidx = str.find(" " + num + " ")
|
||||
self.write('\033[30m' + str[:idx] + '\033[32m' + str[idx:numidx] + '\033[36m' + str[numidx:] + '\033[0m')
|
||||
|
||||
if event == 'return':
|
||||
self.frame_to_local_reprs.pop(frame, None)
|
||||
self.start_times.pop(frame, None)
|
||||
|
|
@ -488,8 +498,8 @@ class Tracer:
|
|||
self.max_variable_length,
|
||||
self.normalize,
|
||||
)
|
||||
self.write('{indent}Return value:.. {return_value_repr}'.
|
||||
format(**locals()))
|
||||
self.write('\033[95m' + '{indent}Return value:.. {return_value_repr}'.
|
||||
format(**locals()) + '\033[0m')
|
||||
|
||||
if event == 'exception':
|
||||
exception = '\n'.join(traceback.format_exception_only(*arg[:2])).strip()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue