INNER CODE UNIT · Python

log

pandolia/easy-service · samples/python-version/worker/main.py:6

def log(s):
    t = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    sys.stdout.write('[%s] %s\n' % (t, s))
    sys.stdout.flush()

def loop():
    log('Started SampleWorker(python version), press enter to exit')
    while running:
        log('Running')
        time.sleep(1)
    log('Stopped SampleWorker(python version)')

running = True
th = threading.Thread(target=loop)
th.start()

try:
    msg = raw_input()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…