changeset 105:62d6725b4db0 default tip

logging
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 25 Jul 2025 14:39:13 -0600 (17 minutes ago)
parents 46418395c860
children
files src/active.js.luan src/heartbeat.js.luan
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/active.js.luan	Mon Jul 14 00:49:11 2025 -0600
+++ b/src/active.js.luan	Fri Jul 25 14:39:13 2025 -0600
@@ -7,6 +7,8 @@
 local remove_notify = Notify.remove or error()
 local Chat = require "site:/lib/Chat.luan"
 local get_chat_by_id = Chat.get_by_id or error()
+local Logging = require "luan:logging/Logging.luan"
+local logger = Logging.logger "active.js"
 
 
 return function()
@@ -14,7 +16,11 @@
 	if spy then
 		return
 	end
-	local user = current_user() or error()
+	local user = current_user()
+	if user == nil then
+		logger.warn("no user")
+		return
+	end
 	remove_notify(user)
 	local chat = Http.request.parameters.chat
 	if chat ~= nil then
--- a/src/heartbeat.js.luan	Mon Jul 14 00:49:11 2025 -0600
+++ b/src/heartbeat.js.luan	Fri Jul 25 14:39:13 2025 -0600
@@ -27,10 +27,7 @@
 return function()
 	local user = current_user()
 	if user == nil then
-		logger.error("no user\n"..trim(Http.request.raw_head).."\n")
-%>
-		location = '/';
-<%
+		logger.warn("no user\n"..trim(Http.request.raw_head).."\n")
 		return
 	end
 	local spy = Http.request.cookies.spy ~= nil