summaryrefslogtreecommitdiff
path: root/portato/log.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-01-27 22:01:27 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-01-27 22:01:27 +0100
commit29297f7e706d8635d582c257aba63d7c3230efdb (patch)
tree97f0510981a39b0947ad4321c45b94011098adbd /portato/log.py
parent6224da7a5810ef8a9309bc0fd919759e832edcf6 (diff)
parent581f7e6b508c43250c4191ad740dd1b31a4ca9af (diff)
downloadportato-29297f7e706d8635d582c257aba63d7c3230efdb.tar.gz
portato-29297f7e706d8635d582c257aba63d7c3230efdb.tar.bz2
portato-29297f7e706d8635d582c257aba63d7c3230efdb.zip
Merged enhanced session handling
Diffstat (limited to '')
-rw-r--r--portato/log.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/portato/log.py b/portato/log.py
index 9c5ebd2..97b1493 100644
--- a/portato/log.py
+++ b/portato/log.py
@@ -39,11 +39,16 @@ class OutputFormatter (logging.Formatter):
for key, value in self.colors.iteritems():
self.colors[key] = "\x1b[01;%02dm*\x1b[39;49;00m" % value
+ if hasattr(sys.stderr, "fileno"):
+ self.istty = os.isatty(sys.stderr.fileno())
+ else:
+ self.istty = False # no fileno -> save default
+
def format (self, record):
string = logging.Formatter.format(self, record)
color = None
- if os.isatty(sys.stderr.fileno()):
+ if self.istty:
if record.levelno <= logging.DEBUG:
color = self.colors["blue"]
elif record.levelno <= logging.INFO: