git » sdk » commit 0ee7860

Only show strophe debug logs when env is set

author Stephen Paul Weber
2024-04-16 13:56:23 UTC
committer Stephen Paul Weber
2024-04-16 13:56:23 UTC
parent 936b2955342bf584be10f51c57b5993b9bdbf316

Only show strophe debug logs when env is set

snikket/streams/XmppStropheStream.hx +4 -1

diff --git a/snikket/streams/XmppStropheStream.hx b/snikket/streams/XmppStropheStream.hx
index 8ea21fb..6b7741d 100644
--- a/snikket/streams/XmppStropheStream.hx
+++ b/snikket/streams/XmppStropheStream.hx
@@ -155,7 +155,10 @@ class XmppStropheStream extends GenericStream {
 	override public function new() {
 		super();
 		StropheCtx.initialize(); // TODO: shutdown?
-		untyped __cpp__("xmpp_log_t *logger = xmpp_get_default_logger(XMPP_LEVEL_DEBUG);");
+		untyped __cpp__("xmpp_log_t *logger = NULL;");
+		if (Sys.getEnv("SNIKKET_XMPP_DEBUG") != null) {
+			untyped __cpp__("logger = xmpp_get_default_logger(XMPP_LEVEL_DEBUG);");
+		}
 		ctx = StropheCtx.create(null, untyped __cpp__("logger"));
 		conn = StropheConn.create(ctx);
 		StropheConn.handler_add(