This line checks whether there is a :: in the message but the line after it splits on " :: ", with spaces around the colons.
If the message contains an IPv6 address (or anything else) with :: in it but no surrounding spaces, it results in an error. It might be better to check for " :: " in the if condition, since that is really what is expected in the split call later.
diff --git a/nemoguardrails/logging/verbose.py b/nemoguardrails/logging/verbose.py
index ac0cab12..b5b8dcdb 100644
--- a/nemoguardrails/logging/verbose.py
+++ b/nemoguardrails/logging/verbose.py
@@ -41,8 +41,8 @@ class VerboseHandler(logging.StreamHandler):
def emit(self, record) -> None:
msg = self.format(record)
- # We check if we're using the spacial syntax with "::" which denotes a title.
- if "::" in msg:
+ # We check if we're using the special syntax with " :: " which denotes a title.
+ if " :: " in msg:
title, body = msg.split(" :: ", 1)
title = title.strip()
This line checks whether there is a
::
in the message but the line after it splits on" :: "
, with spaces around the colons.If the message contains an IPv6 address (or anything else) with
::
in it but no surrounding spaces, it results in an error. It might be better to check for" :: "
in theif
condition, since that is really what is expected in thesplit
call later.