[telepathy-ashes/master] Honour ECHO_LOGFILE environment var.

David Laban david.laban at collabora.co.uk
Sat Oct 24 08:24:24 PDT 2009


---
 ashes/tools/echo_bot.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ashes/tools/echo_bot.py b/ashes/tools/echo_bot.py
index 83810d7..325c844 100644
--- a/ashes/tools/echo_bot.py
+++ b/ashes/tools/echo_bot.py
@@ -1,4 +1,5 @@
 import re
+import os
 import time
 import pdb
 import sys
@@ -154,6 +155,11 @@ def main(connection_regexp='.*echo123.*',
     the echo service on it. Otherwise looks on the bus for connections matching
     connection_regexp.
     """
+    log_filename = os.environ.get('ECHO_LOGFILE', '')
+    if log_filename != '':
+        log_file = open(log_filename, 'w')
+        sys.stdout = log_file
+        sys.stderr = log_file
     runner = EchoBotRunner(contact_regexp=contact_regexp)
     if account_file:
         runner.echo_from_file(account_file)
-- 
1.5.6.5



More information about the telepathy-commits mailing list