aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/app.py
diff options
context:
space:
mode:
Diffstat (limited to 'libpathod/app.py')
-rw-r--r--libpathod/app.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/libpathod/app.py b/libpathod/app.py
index fbb99dc4..7059f9ba 100644
--- a/libpathod/app.py
+++ b/libpathod/app.py
@@ -2,6 +2,16 @@ import urllib, pprint
import tornado.web, tornado.template, tornado.ioloop, tornado.httpserver
import rparse, utils
+
+class APILog(tornado.web.RequestHandler):
+ def get(self):
+ self.write(
+ dict(
+ d = self.application.get_log()
+ )
+ )
+
+
class _Page(tornado.web.RequestHandler):
def render(self, name, **kwargs):
tornado.web.RequestHandler.render(self, name + ".html", **kwargs)
@@ -118,6 +128,7 @@ class PathodApp(tornado.web.Application):
(r"/log/([0-9]+)", OneLog),
(r"/help", Help),
(r"/preview", Preview),
+ (r"/api/log", APILog),
(r"/p/.*", RequestPathod, settings),
],
static_path = utils.data.path("static"),
@@ -179,9 +190,12 @@ class PathodApp(tornado.web.Application):
if i["id"] == id:
return i
- def clear_logs(self):
+ def clear_log(self):
self.log = []
+ def get_log(self):
+ return self.log
+
# begin nocover
def run(application, port, ssl_options):