Skip to content

newline_logging_filter

NewlineLoggingFilter

Bases: Filter

Source code in griptape/configs/logging/newline_logging_filter.py
@define
class NewlineLoggingFilter(logging.Filter):
    replace_str: str = field(default=" ", kw_only=True)

    def filter(self, record: Any) -> bool:
        record.msg = record.msg.replace("\n", self.replace_str)
        return True

replace_str: str = field(default=' ', kw_only=True) class-attribute instance-attribute

filter(record)

Source code in griptape/configs/logging/newline_logging_filter.py
def filter(self, record: Any) -> bool:
    record.msg = record.msg.replace("\n", self.replace_str)
    return True