Changeset - 3693b226b0b8
[Not reviewed]
default
0 2 0
Drew Perttula - 8 years ago 2017-03-30 05:54:42
drewp@bigasterisk.com
update coloredlogs
Ignore-this: c152bd3f4a87270a064d737cbe8a90b0
2 files changed with 12 insertions and 10 deletions:
0 comments (0 inline, 0 general)
bin/run_local.py
Show inline comments
 
@@ -22,33 +22,35 @@ else:
 

	
 
import coloredlogs, logging, time
 
try:
 
    import faulthandler
 
    faulthandler.enable()
 
except ImportError:
 
    pass
 

	
 
progName = sys.argv[0].split('/')[-1]
 
log = logging.getLogger() # this has to get the root logger
 
log.name = progName # but we can rename it for clarity
 

	
 
class FractionTimeFilter(logging.Filter):
 
    def filter(self, record):
 
        record.fractionTime = (
 
            time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(record.created)) +
 
            ("%.3f" % (record.created % 1)).lstrip('0'))
 
        # Don't filter the record.
 
        return 1
 

	
 
class CSH(coloredlogs.ColoredStreamHandler):
 
    def render_timestamp(self, created):
 
        return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(created)) + (
 
            "%.3f" % (created % 1)).lstrip('0')
 

	
 
    def render_name(self, name):
 
        return name
 

	
 
log.addHandler(CSH(show_hostname=False, show_name=True))
 
coloredlogs.install(
 
    level='DEBUG',
 
    fmt='%(fractionTime)s %(name)s[%(process)d] %(levelname)s %(message)s')
 
logging.getLogger().handlers[0].addFilter(FractionTimeFilter())
 

	
 

	
 
def setTerminalTitle(s):
 
    if os.environ.get('TERM', '') in ['xterm', 'rxvt', 'rxvt-unicode-256color']:
 
        print "\033]0;%s\007" % s # not escaped/protected correctly
 

	
 
if 'listsongs' not in sys.argv[0] and 'homepageConfig' not in sys.argv[0]:
 
    setTerminalTitle('[%s] %s' % (socket.gethostname(), ' '.join(sys.argv).replace('bin/', '')))
 

	
 
# see http://www.youtube.com/watch?v=3cIOT9kM--g for commands that make
 
# profiles and set background images
requirements.txt
Show inline comments
 
@@ -3,25 +3,25 @@ Twisted==17.1.0
 
webcolors==1.7
 
Louie==1.1
 
cyclone==1.1
 

	
 
web.py==0.38
 
restkit==4.2.2
 
ipython==5.3.0
 
nose==1.3.7
 
nose-watcher==0.1.3
 
watchdog==0.8.3
 
freezegun==0.3.8
 
ipdb==0.10.2
 
coloredlogs==1.0.1
 
coloredlogs==6.0
 
genshi==0.7
 
pyjade==4.0.0
 
python-dateutil==2.6.0
 
txosc==0.2.0
 
service_identity==16.0.0
 
Pillow==4.0.0
 
faulthandler==2.6
 
treq==17.3.1
 
mock==2.0.0
 
toposort==1.5
 
pyserial==3.3
 

	
0 comments (0 inline, 0 general)