Skip to content

Instantly share code, notes, and snippets.

@willmcgugan
Created March 8, 2015 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willmcgugan/28c62f0a9f018c4e078f to your computer and use it in GitHub Desktop.
Save willmcgugan/28c62f0a9f018c4e078f to your computer and use it in GitHub Desktop.
class MoyaFileHandler(logging.Handler):
def __init__(self, filename):
self._filename = filename
super(MoyaFileHandler, self).__init__()
def emit(self, record):
text = self.format(record)
with io.open(self._filename, 'at', encoding="utf-8") as f:
f.write(text + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment