LogStream#
- class pytest_bluezenv.LogStream(name, pattern=None, tee=None, stream=None)[source]#
Logger that forwards input from a stream to logging, and optionally tees to another stream.
- Parameters:
name (
str) – logger name.pattern (
str) – regular expression with groups for timestamp and message; the input is parsed with it instead of being logged verbatim.tee (
file) – optional stream the input is also written to.stream – existing stream to read from, instead of a fresh socket pair.
Example
from pytest_bluezenv import LogStream log_stream = LogStream("bluetoothctl") subprocess.run(["bluetoothctl", "show"], stdout=log_stream.stream)
- stream#
writable file object that the process output is written to, or None when constructed from an existing stream.
- Type:
file
Methods
close([flush])Close the stream and join the logging thread.