@@ -652,6 +652,35 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on
652
652
:func: `traceback.print_stack `, but with the last newline removed) as a
653
653
string. This default implementation just returns the input value.
654
654
655
+ .. class :: BufferingFormatter(linefmt=None)
656
+
657
+ A base formatter class suitable for subclassing when you want to format a
658
+ number of records. You can pass a :class: `Formatter ` instance which you want
659
+ to use to format each line (that corresponds to a single record). If not
660
+ specified, the default formatter (which just outputs the event message) is
661
+ used as the line formatter.
662
+
663
+ .. method :: formatHeader(records)
664
+
665
+ Return a header for a list of *records *. The base implementation just
666
+ returns the empty string. You will need to override this method if you
667
+ want specific behaviour, e.g. to show the count of records, a title or a
668
+ separator line.
669
+
670
+ .. method :: formatFooter(records)
671
+
672
+ Return a footer for a list of *records *. The base implementation just
673
+ returns the empty string. You will need to override this method if you
674
+ want specific behaviour, e.g. to show the count of records or a separator
675
+ line.
676
+
677
+ .. method :: format(records)
678
+
679
+ Return formatted text for a list of *records *. The base implementation
680
+ just returns the empty string if there are no records; otherwise, it
681
+ returns the concatenation of the header, each record formatted with the
682
+ line formatter, and the footer.
683
+
655
684
.. _filter :
656
685
657
686
Filter Objects
0 commit comments