changeset 833:bdfdfea84510

colored logs Ignore-this: 74b7fb320ebca032b2976da3d00e05ca
author Drew Perttula <drewp@bigasterisk.com>
date Tue, 04 Jun 2013 23:51:57 +0000
parents 231a8b3aedc3
children ae359590eb8a
files bin/rdfdb bin/run_local.py bin/subcomposer pydeps
diffstat 4 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bin/rdfdb	Tue Jun 04 23:18:46 2013 +0000
+++ b/bin/rdfdb	Tue Jun 04 23:51:57 2013 +0000
@@ -122,8 +122,8 @@
 from light9.rdfdb import syncedgraph
 
 from twisted.internet.inotify import INotify
-logging.basicConfig(level=logging.DEBUG)
-log = logging.getLogger()
+from run_local import log
+log.setLevel(logging.DEBUG)
 
 try:
     import sys
--- a/bin/run_local.py	Tue Jun 04 23:18:46 2013 +0000
+++ b/bin/run_local.py	Tue Jun 04 23:51:57 2013 +0000
@@ -17,4 +17,17 @@
         Failure(val, exc, tb).printDetailedTraceback()
 Tkinter.Tk.report_callback_exception = rce
 
+import coloredlogs, logging, time
+log = logging.getLogger()
+
+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))
+
 cgitb.enable(format='txt')
--- a/bin/subcomposer	Tue Jun 04 23:18:46 2013 +0000
+++ b/bin/subcomposer	Tue Jun 04 23:51:57 2013 +0000
@@ -8,7 +8,7 @@
 from twisted.internet import reactor, tksupport, task
 from rdflib import URIRef
 
-import run_local
+from run_local import log
 from light9.dmxchanedit import Levelbox
 from light9 import dmxclient, Patch, Submaster, showconfig, prof
 from light9.uihelpers import toplevelat
@@ -16,8 +16,7 @@
 from light9.rdfdb import clientsession
 from light9.tkdnd import initTkdnd, dragSourceRegister, dropTargetRegister
 
-logging.basicConfig(level=logging.DEBUG)
-log = logging.getLogger()
+log.setLevel(logging.DEBUG)
 
 class _NoNewVal(object):
     pass
--- a/pydeps	Tue Jun 04 23:18:46 2013 +0000
+++ b/pydeps	Tue Jun 04 23:51:57 2013 +0000
@@ -9,4 +9,6 @@
 ipython==0.13.2
 nose==1.3.0
 nose-alert==0.9.0
-ipdb==0.7
\ No newline at end of file
+ipdb==0.7
+# waiting for https://github.com/xolox/python-coloredlogs/pull/1
+git+git://github.com/drewp/python-coloredlogs@9803112ddf7d4cd7dd001912ad1aa482fb8383f6