From c440320f9df04f05ead97bc7a7a016e23e49bb64 Mon Sep 17 00:00:00 2001 From: Leho Kraav Date: Mon, 25 Feb 2013 21:38:05 +0100 Subject: skyped.py: also sanitize log file output --- protocols/skype/skyped.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'protocols/skype/skyped.py') diff --git a/protocols/skype/skyped.py b/protocols/skype/skyped.py index cb57b7ec..88588d96 100644 --- a/protocols/skype/skyped.py +++ b/protocols/skype/skyped.py @@ -256,6 +256,8 @@ def dprint(msg): now = strftime("%Y-%m-%d %H:%M:%S") if options.debug: + sanitized = msg + try: print now + ": " + msg except Exception, s: @@ -267,11 +269,13 @@ def dprint(msg): except Error, s: sanitized = "[unable to print debug message]" print now + "~=" + sanitized + + if options.log: + sock = open(options.log, "a") + sock.write("%s skyped: %s\n" % (now, sanitized)) + sock.close() + sys.stdout.flush() - if options.log: - sock = open(options.log, "a") - sock.write("%s: %s\n" % (now, msg)) - sock.close() class MockedSkype: """Mock class for Skype4Py.Skype(), in case the -m option is used.""" -- cgit v1.2.3