michalczaplinski
2/6/2014 - 5:39 PM

log every N seconds

import threading

def log_periodically(t, message):
    ''' Writes to the user-defined log every t seconds.
        Need to import the threading module '''

    t = threading.Timer(float(t), log_periodically, args=[t, message])
    t.daemon = True
    t.start()
    logging.info(message)