Created
November 30, 2011 17:47
-
-
Save peregrinogris/1409994 to your computer and use it in GitHub Desktop.
Extra simple remote logger
This file contains 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
#!/usr/bin/python | |
from bottle import route, run, debug | |
import argparse | |
parser = argparse.ArgumentParser(description='Really simple remote logger.') | |
parser.add_argument('-n', '--name', default="localhost", help="Name of the host from which the server will start (default: %(default)s)") | |
parser.add_argument('-p', '--port', default=1234, type=int, help="Port the server will be listening (default: %(default)s)") | |
args = parser.parse_args() | |
@route('/:msg') | |
def index(msg=''): | |
print msg | |
return '' | |
print "Listening on http://%s:%d" % (args.name, args.port) | |
run(quiet=True, host=args.name, port=args.port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
simpleLogger
Usage:
First start the server like this:
If serverURL is omitted, the logger will start in localhost. The default port is 1234.
Then simply query the logger in this fashion:
The
[message]
part of the URL will be logged to your terminal.The help can be invoked with:
$ python simpleParser.py -h
Note: This file can be set as executable and simply run as
./simpleLogger.py
Requirements