core/loggingmanager.lua
changeset 11647 f534eeee1552
parent 11645 b03053ec6dcf
child 11661 46fa1b939e88
--- a/core/loggingmanager.lua	Tue Jun 29 16:06:54 2021 +0200
+++ b/core/loggingmanager.lua	Tue Jun 29 16:07:57 2021 +0200
@@ -14,6 +14,7 @@
 local math_max, rep = math.max, string.rep;
 local os_date = os.date;
 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring;
+local st = require "util.stanza";
 
 local config = require "core.configmanager";
 local logger = require "util.logger";
@@ -214,20 +215,23 @@
 
 local do_pretty_printing = true;
 
-local logstyles;
+local logstyles, pretty;
 if do_pretty_printing then
 	logstyles = {};
 	logstyles["info"] = getstyle("bold");
 	logstyles["warn"] = getstyle("bold", "yellow");
 	logstyles["error"] = getstyle("bold", "red");
+
+	pretty = st.pretty_print;
 end
 
 local function log_to_console(sink_config)
 	-- Really if we don't want pretty colours then just use plain stdout
+	if not do_pretty_printing then
+		return log_to_stdout(sink_config);
+	end
+	sink_config.filter = pretty;
 	local logstdout = log_to_stdout(sink_config);
-	if not do_pretty_printing then
-		return logstdout;
-	end
 	return function (name, level, message, ...)
 		local logstyle = logstyles[level];
 		if logstyle then