net.*: Remove tostring call from logging
authorKim Alvefur <zash@zash.se>
Tue, 30 Jul 2019 02:35:17 +0200
changeset 10116 b327f2870382
parent 10115 0f335815244f
child 10117 66a9bc2d5c8d
net.*: Remove tostring call from logging Taken care of by loggingmanager now
net/adns.lua
net/connect.lua
net/http.lua
net/websocket.lua
--- a/net/adns.lua	Tue Jul 30 02:29:36 2019 +0200
+++ b/net/adns.lua	Tue Jul 30 02:35:17 2019 +0200
@@ -73,11 +73,11 @@
 					handler(peek);
 					return;
 				end
-				log("debug", "Records for %s not in cache, sending query (%s)...", qname, tostring(coroutine.running()));
+				log("debug", "Records for %s not in cache, sending query (%s)...", qname, coroutine.running());
 				local ok, err = resolver:query(qname, qtype, qclass);
 				if ok then
 					coroutine.yield(setmetatable({ resolver, qclass or "IN", qtype or "A", qname, coroutine.running()}, query_mt)); -- Wait for reply
-					log("debug", "Reply for %s (%s)", qname, tostring(coroutine.running()));
+					log("debug", "Reply for %s (%s)", qname, coroutine.running());
 				end
 				if ok then
 					ok, err = pcall(handler, resolver:peek(qname, qtype, qclass));
@@ -86,13 +86,13 @@
 					ok, err = pcall(handler, nil, err);
 				end
 				if not ok then
-					log("error", "Error in DNS response handler: %s", tostring(err));
+					log("error", "Error in DNS response handler: %s", err);
 				end
 			end)(resolver:peek(qname, qtype, qclass));
 end
 
 function query_methods:cancel(call_handler, reason) -- luacheck: ignore 212/reason
-	log("warn", "Cancelling DNS lookup for %s", tostring(self[4]));
+	log("warn", "Cancelling DNS lookup for %s", self[4]);
 	self[1].cancel(self[2], self[3], self[4], self[5], call_handler);
 end
 
--- a/net/connect.lua	Tue Jul 30 02:29:36 2019 +0200
+++ b/net/connect.lua	Tue Jul 30 02:35:17 2019 +0200
@@ -38,7 +38,7 @@
 		p:log("debug", "Next target to try is %s:%d", ip, port);
 		local conn, err = server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra);
 		if not conn then
-			log("debug", "Connection attempt failed immediately: %s", tostring(err));
+			log("debug", "Connection attempt failed immediately: %s", err);
 			p.last_error = err or "unknown reason";
 			return attempt_connection(p);
 		end
--- a/net/http.lua	Tue Jul 30 02:29:36 2019 +0200
+++ b/net/http.lua	Tue Jul 30 02:35:17 2019 +0200
@@ -40,7 +40,7 @@
 local function handleerr(err) log("error", "Traceback[http]: %s", traceback(tostring(err), 2)); return err; end
 local function log_if_failed(req, ret, ...)
 	if not ret then
-		log("error", "Request '%s': error in callback: %s", req.id, tostring((...)));
+		log("error", "Request '%s': error in callback: %s", req.id, (...));
 		if not req.suppress_errors then
 			error(...);
 		end
@@ -150,7 +150,7 @@
 	local request = requests[conn];
 
 	if not request then
-		log("warn", "Received response from connection %s with no request attached!", tostring(conn));
+		log("warn", "Received response from connection %s with no request attached!", conn);
 		return;
 	end
 
--- a/net/websocket.lua	Tue Jul 30 02:29:36 2019 +0200
+++ b/net/websocket.lua	Tue Jul 30 02:35:17 2019 +0200
@@ -131,7 +131,7 @@
 function websocket_methods:close(code, reason)
 	if self.readyState < 2 then
 		code = code or 1000;
-		log("debug", "closing WebSocket with code %i: %s" , code , tostring(reason));
+		log("debug", "closing WebSocket with code %i: %s" , code , reason);
 		self.readyState = 2;
 		local conn = self.conn;
 		conn:write(frames.build_close(code, reason, true));
@@ -245,7 +245,7 @@
 		   or (protocol and not protocol[r.headers["sec-websocket-protocol"]])
 		   then
 			s.readyState = 3;
-			log("warn", "WebSocket connection to %s failed: %s", url, tostring(b));
+			log("warn", "WebSocket connection to %s failed: %s", url, b);
 			if s.onerror then s:onerror("connecting-failed"); end
 			return;
 		end