def followLog(serverLogsDir):
    logFilePattern = '*_DebugLog-server.txt'
    logFiles = glob.glob(path.join(serverLogsDir, logFilePattern))
    if (not logFiles):
        (yield 'data: {}\n\n'.format(json.dumps({'error': True, 'errorMessage': 'No log file found'})))
        return
    logFiles.sort(reverse=True)
    with open(logFiles[0]) as serverLogFile:
        try:
            while True:
                line = serverLogFile.readline()
                if (not line):
                    continue
                time.sleep(0.01)
                (yield 'data: {}\n\n'.format(json.dumps({'log': line.strip()})))
        finally:
            pass
def followLog(serverLogsDir):
    logFilePattern = '*_DebugLog-server.txt'
    logFiles = glob.glob(path.join(serverLogsDir, logFilePattern))
    if (not logFiles):
        (yield 'data: {}\n\n'.format(json.dumps({'error': True, 'errorMessage': 'No log file found'})))
        return
    logFiles.sort(reverse=True)
    with open(logFiles[0]) as serverLogFile:
        try:
            while True:
                line = serverLogFile.readline()
                if (not line):
                    continue
                time.sleep(0.01)
                (yield 'data: {}\n\n'.format(json.dumps({'log': line.strip()})))
        finally:
            pass