NeMo-Guardrails
NeMo-Guardrails copied to clipboard
Error in `VerboseHandler` when `::` present in log messages but not ` :: `.
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()
Thanks for reporting this @munircontractor. I thought this was fixed as this was raised before. We'll fix for 0.10.0.
Hey @drazvan, seems like this is fixed by you. Can the issue be closed.
Fixed in #603.