Comparison

core/loggingmanager.lua @ 11657:46fa1b939e88

core.loggingmanager: Disable pretty printing when not connected to a tty Things can behave unexpectedly when fed ANSI escape codes.
author Kim Alvefur <zash@zash.se>
date Sun, 04 Jul 2021 15:11:53 +0200
parent 11643:f534eeee1552
child 12247:dcad8940f072
comparison
equal deleted inserted replaced
11656:c368b4f6ee04 11657:46fa1b939e88
211 end 211 end
212 return log_to_file(sink_config, stdout); 212 return log_to_file(sink_config, stdout);
213 end 213 end
214 log_sink_types.stdout = log_to_stdout; 214 log_sink_types.stdout = log_to_stdout;
215 215
216 local do_pretty_printing = true; 216 local do_pretty_printing = not have_pposix or pposix.isatty(stdout);
217 217
218 local logstyles, pretty; 218 local logstyles, pretty;
219 if do_pretty_printing then 219 if do_pretty_printing then
220 logstyles = {}; 220 logstyles = {};
221 logstyles["info"] = getstyle("bold"); 221 logstyles["info"] = getstyle("bold");