changeset 90:5240c054dcd4

logging
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 13 Mar 2025 18:58:48 -0600
parents 3053a4fc10be
children 9196d936d4fa
files src/error_log.js.luan src/private/tools/error.html
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/error_log.js.luan	Thu Mar 13 17:56:39 2025 -0600
+++ b/src/error_log.js.luan	Thu Mar 13 18:58:48 2025 -0600
@@ -4,12 +4,21 @@
 local trim = String.trim or error()
 local regex = String.regex or error()
 local contains = String.contains or error()
+local Table = require "luan:Table.luan"
+local concat = Table.concat or error()
 local Http = require "luan:http/Http.luan"
 local Logging = require "luan:logging/Logging.luan"
 local logger = Logging.logger "error_log.js"
 
 
+local bad_agents = {
+	[[Version/14\.]]
+}
+local bad_agents_ptn = regex(concat(bad_agents,"|"))
+
 local function priority(err)
+	local agent = Http.request.headers["user-agent"]
+	if agent~=nil and bad_agents_ptn.matches(agent) then return "info" end
 	return "error"
 end
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/private/tools/error.html	Thu Mar 13 18:58:48 2025 -0600
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+	<head>
+		<meta name="viewport" content="width=device-width, initial-scale=1">
+		<script src=/site.js></script>
+		<script>
+			function err() {
+				qqq();
+				ajax('/qqq');
+			}
+		</script>
+	</head>
+	<body>
+		<button onclick="err()">error</button>
+	</body>
+</html>