Created
March 2, 2013 13:55
-
-
Save dawn110110/5071107 to your computer and use it in GitHub Desktop.
Use tonado's LogFormatter out of tornado. just use it as an ordinary LogFormatter, of cource tornado has to be installed.
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
# use tornado's formatter out of tornado | |
try: | |
from tornado.options import _LogFormatter as Fmt # tornado 2.2 | |
except: | |
from tornado.log import LogFormatter as Fmt # toando 2.4 | |
class TornadoFormatter(Fmt): | |
''' require toanado installed | |
usuage: | |
use it as an ordinary LogFormatter | |
''' | |
def __init__(self, *args, **kargs): | |
TornadoFormatter.setterm() | |
Fmt.__init__(self, *args, **kargs) | |
@classmethod | |
def setterm(cls): | |
if hasattr(cls, '_setterm_called'): | |
pass | |
else: | |
import curses | |
curses.setupterm() | |
cls._setterm_called = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment