mirror of https://github.com/cool-RR/PySnooper.git
Indent based on how many calls are currently being traced
This commit is contained in:
parent
1bcaea2059
commit
8f91784821
|
@ -246,6 +246,7 @@ class Tracer:
|
|||
# or the user asked to go a few levels deeper and we're within that
|
||||
# number of levels deeper.
|
||||
|
||||
depth = 0
|
||||
if not (frame.f_code in self.target_codes or frame in self.target_frames):
|
||||
if self.depth == 1:
|
||||
# We did the most common and quickest check above, because the
|
||||
|
@ -256,17 +257,19 @@ class Tracer:
|
|||
return None
|
||||
else:
|
||||
_frame_candidate = frame
|
||||
for i in range(1, self.depth):
|
||||
for depth in range(1, self.depth):
|
||||
_frame_candidate = _frame_candidate.f_back
|
||||
if _frame_candidate is None:
|
||||
return None
|
||||
elif _frame_candidate.f_code in self.target_codes or _frame_candidate in self.target_frames:
|
||||
indent = ' ' * 4 * i
|
||||
break
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
indent = ''
|
||||
|
||||
stack = self.thread_local.original_trace_functions
|
||||
depth += len(stack) - 1
|
||||
indent = ' ' * 4 * depth
|
||||
|
||||
# #
|
||||
### Finished checking whether we should trace this line. ##############
|
||||
|
||||
|
|
Loading…
Reference in New Issue