Changeset 52ceb4b for protocols/skype


Ignore:
Timestamp:
2013-03-06T19:56:19Z (11 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
83c246e
Parents:
8407e25
Message:

skyped: prefix debug messages with source location

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/skype/skyped.py

    r8407e25 r52ceb4b  
    254254        global options
    255255
    256         now = strftime("%Y-%m-%d %H:%M:%S")
    257 
    258256        if options.debug:
     257                import inspect
     258                prefix = strftime("[%Y-%m-%d %H:%M:%S]") + " %s:%d" % inspect.stack()[1][1:3]
    259259                sanitized = msg
    260260
    261261                try:
    262                         print now + ": " + msg
     262                        print prefix + ": " + msg
    263263                except Exception, s:
    264264                        try:
     
    269269                                except Error, s:
    270270                                        sanitized = "[unable to print debug message]"
    271                         print now + "~=" + sanitized
     271                        print prefix + "~=" + sanitized
    272272
    273273                if options.log:
    274274                        sock = open(options.log, "a")
    275                         sock.write("%s skyped: %s\n" % (now, sanitized))
     275                        sock.write(prefix + ": " + sanitized)
    276276                        sock.close()
    277277
Note: See TracChangeset for help on using the changeset viewer.