equal
deleted
inserted
replaced
3464 msg=b'stacktrace', |
3464 msg=b'stacktrace', |
3465 skip=0, |
3465 skip=0, |
3466 f=procutil.stderr, |
3466 f=procutil.stderr, |
3467 otherf=procutil.stdout, |
3467 otherf=procutil.stdout, |
3468 depth=0, |
3468 depth=0, |
|
3469 prefix=b'', |
3469 ): |
3470 ): |
3470 '''Writes a message to f (stderr) with a nicely formatted stacktrace. |
3471 '''Writes a message to f (stderr) with a nicely formatted stacktrace. |
3471 Skips the 'skip' entries closest to the call, then show 'depth' entries. |
3472 Skips the 'skip' entries closest to the call, then show 'depth' entries. |
3472 By default it will flush stdout first. |
3473 By default it will flush stdout first. |
3473 It can be used everywhere and intentionally does not require an ui object. |
3474 It can be used everywhere and intentionally does not require an ui object. |
3474 Not be used in production code but very convenient while developing. |
3475 Not be used in production code but very convenient while developing. |
3475 ''' |
3476 ''' |
3476 if otherf: |
3477 if otherf: |
3477 otherf.flush() |
3478 otherf.flush() |
3478 f.write(b'%s at:\n' % msg.rstrip()) |
3479 f.write(b'%s%s at:\n' % (prefix, msg.rstrip())) |
3479 for line in getstackframes(skip + 1, depth=depth): |
3480 for line in getstackframes(skip + 1, depth=depth): |
3480 f.write(line) |
3481 f.write(prefix + line) |
3481 f.flush() |
3482 f.flush() |
3482 |
3483 |
3483 |
3484 |
3484 # convenient shortcut |
3485 # convenient shortcut |
3485 dst = debugstacktrace |
3486 dst = debugstacktrace |