python logging capture stdout