Mercurial Hosting > chat
diff src/error_log.js.luan @ 3:2c63b10781e1
add login
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 24 Oct 2024 21:43:44 -0600 |
parents | |
children | 5240c054dcd4 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/error_log.js.luan Thu Oct 24 21:43:44 2024 -0600 @@ -0,0 +1,23 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local String = require "luan:String.luan" +local trim = String.trim or error() +local regex = String.regex or error() +local contains = String.contains or error() +local Http = require "luan:http/Http.luan" +local Logging = require "luan:logging/Logging.luan" +local logger = Logging.logger "error_log.js" + + +local function priority(err) + return "error" +end + +return function() + local err = Http.request.parameters.err + if err == nil then + return -- stupid bots + end + local call = priority(err) + logger[call](trim(err).."\n"..trim(Http.request.raw_head).."\n") +end