Package pyplusplus :: Package _logging_ :: Module multi_line_formatter :: Class multi_line_formatter_t |

# ClassType multi_line_formatter_t

source code

    logging.Formatter --+
                        |
                       multi_line_formatter_t

Custom log formatter to split long message into several lines.

This formatter is used for the default stream handler that outputs its messages to stdout.

Instance Methods
__init__(self, fmt=None, datefmt=None, width=None) Constructor. | source code
format(self, record) This method overwrites the original one. | source code
Inherited from `logging.Formatter`: `converter`, `formatException`, `formatTime`

Static Methods
formatMessage(msgline, width=70) Format a long single line message so that it is easier to read. | source code

Method Details

### __init__(self, fmt=None, datefmt=None, width=None) (Constructor) | source code
Constructor. See the Python standard library reference for a documentation of fmt and datefmt. width is the maximum width of the generated text blocks. Overrides: logging.Formatter.__init__

### format(self, record) | source code
    This method overwrites the original one.

    The first thing that is done in the original format() method
    is the creation of the record.message attribute:

      record.message = record.getMessage()

    Now this method temporarily replaces the getMessage() method of
    the record by a version that returns a pregenerated message that
    spans several lines. Then the original format() method is called
    which will invoke the 'fake' method.
Overrides: logging.Formatter.format

### formatMessage(msgline, width=70) Static Method | source code
Format a long single line message so that it is easier to read. msgline is a string containing a single message. It can either be a plain message string which is reformatted using the textwrap module or it can be of the form <decl>;<msg> where <decl> is the declaration string and <msg> an arbitrary message. Lines of this form will be separated so that the declaration and the message appear in individual text blocks, where every line of message will start with '>' character. width is the maximum width of any text blocks (without indendation).