We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Maybe somehow related to #737 and #313)
Consider the following code from #313 :
class TqdmToLogger(io.StringIO): """ Output stream for TQDM which will output to logger module instead of the StdOut. """ logger = None level = None buf = '' def __init__(self,logger,level=None): super(TqdmToLogger, self).__init__() self.logger = logger self.level = level or logging.INFO def write(self,buf): self.buf = buf.strip('\r\n\t ') def flush(self): self.logger.log(self.level, self.buf) if __name__ == "__main__": logging.basicConfig(format='%(asctime)s [%(levelname)-8s] %(message)s') logger = logging.getLogger() logger.setLevel(logging.DEBUG) tqdm_out = TqdmToLogger(logger,level=logging.INFO) for x in tqdm(range(100),file=tqdm_out,mininterval=30,): time.sleep(.5)
Would that be possible to write to both sys.stdout (or sys.stderr depending on the context) AND TqdmToLogger?
sys.stdout
sys.stderr
TqdmToLogger
I tried to write to sys.stdout directly in TqdmToLogger but tqdm seems to do some fancy things when self.fp is sys.stdout or sys.stderr.
self.fp
The text was updated successfully, but these errors were encountered:
No branches or pull requests
(Maybe somehow related to #737 and #313)
Consider the following code from #313 :
Would that be possible to write to both
sys.stdout
(orsys.stderr
depending on the context) ANDTqdmToLogger
?I tried to write to
sys.stdout
directly inTqdmToLogger
but tqdm seems to do some fancy things whenself.fp
issys.stdout
orsys.stderr
.The text was updated successfully, but these errors were encountered: