Fix the intermittent UnicodeDecodeError when the debug log is truncated on an (multi-byte) unicode character by treating everything as bytes.
Also, remove the ignore_case option and there.search+re.escape wrap. All of this is unused and doesn't exist on raw byte strings.
This is a backport of core#25294
Depends on D12622
Note:
I added a typehint for expected_msgs because imo the parameter name is now misleading with regards to its type. This allowed the mypy linter to detect that a subsequent line defining print_log is now broken because log is now of type bytes and you cannot join bytes with str