From 3365acf69fcc269c52dac405f674cc094faeb64c Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 30 Apr 2012 09:54:49 +1200 Subject: Clear log API. --- README.mkd | 6 ++++++ libpathod/app.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/README.mkd b/README.mkd index 0c5f2eb4..bf5634ba 100644 --- a/README.mkd +++ b/README.mkd @@ -284,6 +284,12 @@ Where each entry looks like this: 'started': 1335735586.469218 } +You can preview the JSON data returned for a log entry through the built-in web +interface. + +### /api/log/clear + +A POST to this URL clears the log buffer. # Installing diff --git a/libpathod/app.py b/libpathod/app.py index 7059f9ba..ca24c62c 100644 --- a/libpathod/app.py +++ b/libpathod/app.py @@ -12,6 +12,12 @@ class APILog(tornado.web.RequestHandler): ) +class APILogClear(tornado.web.RequestHandler): + def post(self): + self.application.clear_log() + self.write("OK") + + class _Page(tornado.web.RequestHandler): def render(self, name, **kwargs): tornado.web.RequestHandler.render(self, name + ".html", **kwargs) @@ -129,6 +135,7 @@ class PathodApp(tornado.web.Application): (r"/help", Help), (r"/preview", Preview), (r"/api/log", APILog), + (r"/api/log/clear", APILogClear), (r"/p/.*", RequestPathod, settings), ], static_path = utils.data.path("static"), -- cgit v1.2.3