fork download
  1. import logging
  2. from time import time as timer
  3. from threading import Timer
  4.  
  5. logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%H:%M:%S')
  6.  
  7. def function1(interval, maxtime):
  8. logging.warning('write logs')
  9. if timer() < maxtime:
  10. Timer(interval, function1, (interval, maxtime)).start()
  11.  
  12. function1(1, timer()+10)
  13.  
  14.  
Success #stdin #stdout 0.05s 23232KB
stdin
Standard input is empty
stdout
Standard output is empty