#!/usr/bin/env python3
""" Inserts the current time before each input line """

import sys
import argparse
from tplogtools.timetools import local_tz_now

def main():
    """Main function of logtime"""
    parser = argparse.ArgumentParser(description=__doc__)
    parser.parse_args()
    try:
        while True:
            line = sys.stdin.buffer.readline()
            if line == b'':
                break
            now = local_tz_now()
            sys.stdout.buffer.write(now.isoformat().encode('utf8')+b' '+line)
            sys.stdout.buffer.flush()
    except KeyboardInterrupt:
        pass

if __name__ == '__main__':
    main()
