changeset 5928:0b347a7c5b5f

mod_log_json: Support for logging to stdout Hacky, but should work.
author Matthew Wild <mwild1@gmail.com>
date Thu, 11 Jul 2024 10:15:21 +0100
parents 07f32bf41303
children c094eabdb30f
files mod_log_json/mod_log_json.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_log_json/mod_log_json.lua	Mon Jul 08 10:47:07 2024 +0200
+++ b/mod_log_json/mod_log_json.lua	Thu Jul 11 10:15:21 2024 +0100
@@ -9,7 +9,12 @@
 local function sink_maker(config)
 	local send = function () end
 	if config.filename then
-		local logfile = io.open(config.filename, "a+");
+		local logfile;
+		if config.filename == "/dev/stdout" then
+			logfile = io.stdout;
+		else
+			logfile = io.open(config.filename, "a+");
+		end
 		logfile:setvbuf("no");
 		function send(payload)
 			logfile:write(payload, "\n");