summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/weblit/logger.lua
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-02-14 10:58:18 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2016-02-14 10:58:18 +0100
commitccae0382bb750c1deded19e05b34933a8303465e (patch)
tree1a2f0ae972163e6c1c76611b464d4257947c003e /plugins/weblit/logger.lua
parent2db49088141b6238e92aecc4c073076a02c73065 (diff)
Added plugins and boot.lua as startup script [Miodrag Milanovic]
Diffstat (limited to 'plugins/weblit/logger.lua')
-rw-r--r--plugins/weblit/logger.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/weblit/logger.lua b/plugins/weblit/logger.lua
new file mode 100644
index 00000000000..912b4eed768
--- /dev/null
+++ b/plugins/weblit/logger.lua
@@ -0,0 +1,10 @@
+
+return function (req, res, go)
+ -- Skip this layer for clients who don't send User-Agent headers.
+ local userAgent = req.headers["user-agent"]
+ if not userAgent then return go() end
+ -- Run all inner layers first.
+ go()
+ -- And then log after everything is done
+ --print(string.format("%s %s %s %s", req.method, req.path, userAgent, res.code))
+end