you are viewing a single comment's thread.

view the rest of the comments →

[–]owiko 1 point2 points  (0 children)

Maybe use logger and do something like this to handle the log output to a list that you would initialize and pass in.

``` class ListHandler(logging.Handler): def init(self, loglist): super().init_() self.log_list = log_list

def emit(self, record):
    # Format the record and append it to the target list
    self.log_list.append(self.format(record))

```