Fix ANSI color removal for XMPP log on non-tty stderrs

This commit is contained in:
hrxi 2019-05-31 23:25:07 +02:00 committed by fiaxh
parent 8120203d62
commit 7097a71852

View file

@ -110,13 +110,13 @@ public class XmppLog {
public void node(string what, StanzaNode node) { public void node(string what, StanzaNode node) {
if (should_log_node(node)) { if (should_log_node(node)) {
stderr.printf("%sXMPP %s [%s]%s\n%s\n", ANSI_COLOR_WHITE, what, ident, ANSI_COLOR_END, use_ansi ? node.to_ansi_string(hide_ns) : node.to_string()); stderr.printf("%sXMPP %s [%s]%s\n%s\n", use_ansi ? ANSI_COLOR_WHITE : "", what, ident, use_ansi ? ANSI_COLOR_END : "", use_ansi ? node.to_ansi_string(hide_ns) : node.to_string());
} }
} }
public void str(string what, string str) { public void str(string what, string str) {
if (should_log_str(str)) { if (should_log_str(str)) {
stderr.printf("%sXMPP %s [%s]%s\n%s\n", ANSI_COLOR_WHITE, what, ident, ANSI_COLOR_END, str); stderr.printf("%sXMPP %s [%s]%s\n%s\n", use_ansi ? ANSI_COLOR_WHITE : "", what, ident, use_ansi ? ANSI_COLOR_END : "", str);
} }
} }