Last active
May 19, 2017 04:25
-
-
Save w495/80f6a7351a10d5b6cecb5dad6c8cd8d6 to your computer and use it in GitHub Desktop.
OneLineHandler for http://stackoverflow.com/a/38895482/2586820
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
class OneLineHandler(logging.StreamHandler): | |
def emit(self, record): | |
try: | |
msg = self.format(record) | |
stream = self.stream | |
stream.write('\u001b[1000D' + msg) | |
self.flush() | |
except Exception: | |
self.handleError(record) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment