diff options
| author | Leho Kraav <leho@kraav.com> | 2013-02-25 21:38:05 +0100 | 
|---|---|---|
| committer | Miklos Vajna <vmiklos@suse.cz> | 2013-02-25 21:38:05 +0100 | 
| commit | c440320f9df04f05ead97bc7a7a016e23e49bb64 (patch) | |
| tree | 2b57cb1894828f033a731edc98df975aefe8bc17 /protocols | |
| parent | 0e788f52f992be8792a4cc1218b378370326e5af (diff) | |
skyped.py: also sanitize log file output
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/skype/skyped.py | 12 | 
1 files changed, 8 insertions, 4 deletions
| 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.""" | 
