Ensure only telnetliquidsoap has telnet responsibilities

-also added module docstrings
This commit is contained in:
Martin Konecny 2013-05-16 16:19:00 -04:00
parent 888e6db812
commit 060980d8c6
13 changed files with 303 additions and 389 deletions

View file

@ -1,6 +1,17 @@
"""
std_err_override.LogWriter
~~~~~~~~~
This module presents a simple function to reroute output intended
for stderr to the output log file.
:author: (c) 2012 by Martin Konecny.
:license: GPLv3, see LICENSE for more details.
"""
import sys
class LogWriter():
class _LogWriter():
def __init__(self, logger):
self.logger = logger
@ -8,4 +19,8 @@ class LogWriter():
self.logger.error(txt)
def override_std_err(logger):
sys.stderr = LogWriter(logger)
"""
Create wrapper to intercept any messages that would have been printed out
to stderr and write them to our logger instead.
"""
sys.stderr = _LogWriter(logger)