I like loguru very much. but I'm using the unit test framework to generate reports to read data in StringIo. Is there any way to solve this problem??
@flybaozi Did you find a solution? 馃槃
I'd like to know this as well.
@Zylatis It should work fine using a StringIO object as the logger sink:
from loguru import logger
from io import StringIO
stream = StringIO()
logger.remove()
logger.add(stream)
logger.info("Foo")
logger.debug("Bar: {}", 123)
print(stream.getvalue())
Are you having trouble with anything?
Hmm I definitely tried that and was having no luck, but possibly i was using .read() not .getvalue(), thanks! (might've also just had too much wine and put things in the wrong order...)