mirror of
https://github.com/k4yt3x/video2x.git
synced 2024-12-29 16:09:10 +00:00
BiLogger now inherits io.TextIOWrapper and has a fileno attribute
This commit is contained in:
parent
cc89b0aac5
commit
f4be9cc596
@ -4,21 +4,21 @@
|
|||||||
Creator: Video2X Bidirectional Logger
|
Creator: Video2X Bidirectional Logger
|
||||||
Author: K4YT3X
|
Author: K4YT3X
|
||||||
Date Created: June 4, 2020
|
Date Created: June 4, 2020
|
||||||
Last Modified: September 13, 2020
|
Last Modified: December 13, 2020
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# built-in imports
|
# built-in imports
|
||||||
import _io
|
import io
|
||||||
|
|
||||||
|
|
||||||
class BiLogger(object):
|
class BiLogger(io.TextIOWrapper):
|
||||||
""" A bidirectional logger that both prints the output
|
""" A bidirectional logger that both prints the output
|
||||||
and log all output to file.
|
and log all output to file.
|
||||||
|
|
||||||
Original code from: https://stackoverflow.com/a/14906787
|
Original code from: https://stackoverflow.com/a/14906787
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, terminal: _io.TextIOWrapper, log_file: _io.BufferedRandom):
|
def __init__(self, terminal: io.TextIOWrapper, log_file: io.BufferedRandom):
|
||||||
""" initialize BiLogger
|
""" initialize BiLogger
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -27,6 +27,7 @@ class BiLogger(object):
|
|||||||
"""
|
"""
|
||||||
self.terminal = terminal
|
self.terminal = terminal
|
||||||
self.log_file = log_file
|
self.log_file = log_file
|
||||||
|
self.fileno = self.log_file.fileno
|
||||||
|
|
||||||
def write(self, message: str):
|
def write(self, message: str):
|
||||||
""" write message to original terminal output and log file
|
""" write message to original terminal output and log file
|
||||||
|
Loading…
Reference in New Issue
Block a user