def open_telemetry_logs(logpath_telem, logpath_telem_raw):
    '''open log files'''
    if opts.append_log or opts.continue_mode:
        mode = 'ab'
    else:
        mode = 'wb'

    try:
        mpstate.logfile = open(logpath_telem, mode=mode)
        mpstate.logfile_raw = open(logpath_telem_raw, mode=mode)
        print("Log Directory: %s" % mpstate.status.logdir)
        print("Telemetry log: %s" % logpath_telem)

        #make sure there's enough free disk space for the logfile (>200Mb)
        #statvfs doesn't work in Windows
        if platform.system() != 'Windows':
            stat = os.statvfs(logpath_telem)
            if stat.f_bfree*stat.f_bsize < 209715200:
                print("ERROR: Not enough free disk space for logfile")
                mpstate.status.exit = True
                return

        # use a separate thread for writing to the logfile to prevent
        # delays during disk writes (important as delays can be long if camera
        # app is running)
        t = threading.Thread(target=log_writer, name='log_writer')
        t.daemon = True
        t.start()
    except Exception as e:
        print("ERROR: opening log file for writing: %s" % e)
        mpstate.status.exit = True
        return
open log files