(self, record)
| 616 | nlindent = '\n' + indent |
| 617 | |
| 618 | def format(self, record): |
| 619 | # use the default formatter to actually format the record |
| 620 | msg = super(Formatter, self).format(record) |
| 621 | |
| 622 | # then put on a prefix symbol according to the message type |
| 623 | |
| 624 | msgtype = getattr(record, 'pwnlib_msgtype', None) |
| 625 | |
| 626 | # if 'pwnlib_msgtype' is not set (or set to `None`) we just return the |
| 627 | # message as it is |
| 628 | if msgtype is None: |
| 629 | return msg |
| 630 | |
| 631 | if msgtype in _msgtype_prefixes: |
| 632 | style, symb = _msgtype_prefixes[msgtype] |
| 633 | prefix = '[%s] ' % style(symb) |
| 634 | elif msgtype == 'indented': |
| 635 | prefix = self.indent |
| 636 | elif msgtype == 'animated': |
| 637 | # the handler will take care of updating the spinner, so we will |
| 638 | # not include it here |
| 639 | prefix = '' |
| 640 | else: |
| 641 | # this should never happen |
| 642 | prefix = '[?] ' |
| 643 | |
| 644 | msg = prefix + msg |
| 645 | msg = self.nlindent.join(msg.splitlines()) |
| 646 | return msg |
| 647 | |
| 648 | def _need_text(s): |
| 649 | # circular import wrapper |
no outgoing calls
no test coverage detected