mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-19 10:21:19 +02:00
qwq
This commit is contained in:
parent
a3fb75eb11
commit
de476aac46
@ -49,6 +49,28 @@ class ColorizingStreamHandler(logging.StreamHandler):
|
||||
isatty = getattr(self.stream, 'isatty', None)
|
||||
return isatty and isatty() and not self.disable_coloring
|
||||
|
||||
def emit(self, record):
|
||||
try:
|
||||
message = self.format(record)
|
||||
stream = self.stream
|
||||
|
||||
if not self.is_tty:
|
||||
if message and message[0] == "\r":
|
||||
message = message[1:]
|
||||
stream.write(message)
|
||||
else:
|
||||
self.output_colorized(message)
|
||||
stream.write(getattr(self, 'terminator', '\n'))
|
||||
|
||||
self.flush()
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
except IOError:
|
||||
pass
|
||||
except:
|
||||
self.handleError(record)
|
||||
|
||||
|
||||
if not platform.system() == 'Windows':
|
||||
def output_colorized(self, message):
|
||||
self.stream.write(message)
|
||||
|
Loading…
x
Reference in New Issue
Block a user