def writeTestFile(): # Write the command test output to the error file try: log_file = open(getTestFilePath(), 'r') log_output = log_file.readlines() log_file.close() infoTrace("platform.py", "Command test file start >>>") for line in log_output: infoPrint(line) infoTrace("platform.py", "<<< Command test file end") except Exception as e: errorTrace("platform.py", "Couldn't write test file") errorTrace("platform.py", str(e))
def writeVPNLog(): # Write the openvpn output log to the error file try: log_file = open(getVPNLogFilePath(), 'r') log_output = log_file.readlines() log_file.close() infoTrace("platform.py", "VPN log file start >>>") for line in log_output: infoPrint(line) infoTrace("platform.py", "<<< VPN log file end") except Exception as e: errorTrace("platform.py", "Couldn't write VPN error log") errorTrace("platform.py", str(e))
def writeVPNConfiguration(ovpn): # Write the openvpn configuration to the error file try: if xbmcvfs.exists(ovpn): ovpn_file = open(ovpn, 'r') ovpn_output = ovpn_file.readlines() ovpn_file.close() infoTrace("vpnplatform.py", "VPN configuration " + ovpn + " start >>>") for line in ovpn_output: infoPrint(line) infoTrace("vpnplatform.py", "<<< VPN configuration file end") else: infoTrace("vpnplatform.py", "No VPN configuration " + ovpn + " exists to write") except Exception as e: errorTrace("vpnplatform.py", "Couldn't write VPN error log") errorTrace("vpnplatform.py", str(e))