Created
August 17, 2010 18:11
-
-
Save mikitebeka/531214 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def stdout_readline(process): | |
| return process.stdout.readline() | |
| def make_web_readline(url): | |
| def web_readline(process): | |
| return urlopen(url).read() | |
| return web_readline | |
| def run_logger(server_process, name, readline): | |
| def logfunc(): | |
| while True: | |
| try: | |
| line = readline(server_process) | |
| except AttributeError: | |
| break | |
| exitcode = server_process.poll() | |
| if (not line) and (exitcode is not None): | |
| break | |
| if line: | |
| line = line[:-1] | |
| log(name, line.rstrip()) | |
| daemon_thread(logfunc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment