#!/usr/bin/env python

# This file is part of Window-Switch.
# Copyright (c) 2009-2013 Antoine Martin <antoine@nagafix.co.uk>
# Window-Switch is released under the terms of the GNU GPL v3

import time
import os

from winswitch.util.simple_logger import Logger
logger=Logger("log_parser_test", log_colour=Logger.RED, _debug=True)

def main():
	filename = "./test.log"
	f = os.open(filename, os.O_RDONLY)
	logger.slog("opened file %s" % f)
	#pf = os.fdopen(f, 'rb', 0)
	#logger.slog("opened python file %s" % pf)
	while True:
		data = os.read(f, 32)
		#lines = pf.readlines()
		logger.slog("read %s" % str(data))
		logger.slog("len=%s" % len(data))
		#logger.slog("read %s" % str(lines))
		#logger.slog("tell=%s" % pf.tell())
		time.sleep(1)

if __name__ == "__main__":
	main()
