Mercurial Hosting > lang
comparison src/error_log.js.luan @ 63:3d9903900a71
logging
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 19 Aug 2025 09:29:54 +0900 |
parents | 1c87f785eb42 |
children |
comparison
equal
deleted
inserted
replaced
62:bd3f16f7b8b7 | 63:3d9903900a71 |
---|---|
9 local Http = require "luan:http/Http.luan" | 9 local Http = require "luan:http/Http.luan" |
10 local Logging = require "luan:logging/Logging.luan" | 10 local Logging = require "luan:logging/Logging.luan" |
11 local logger = Logging.logger "error_log.js" | 11 local logger = Logging.logger "error_log.js" |
12 | 12 |
13 | 13 |
14 local bad_agents = { | |
15 [[Firefox/]] | |
16 } | |
17 local bad_agents_ptn = regex(concat(bad_agents,"|")) | |
14 | 18 |
15 local function priority(err) | 19 local function priority(err) |
20 local agent = Http.request.headers["user-agent"] | |
21 if agent~=nil and bad_agents_ptn.matches(agent) then return "info" end | |
16 return "error" | 22 return "error" |
17 end | 23 end |
18 | 24 |
19 return function() | 25 return function() |
20 local err = Http.request.parameters.err | 26 local err = Http.request.parameters.err |