Copilot commented on code in PR #284:
URL:
https://github.com/apache/incubator-hugegraph-ai/pull/284#discussion_r2218794231
##########
hugegraph-llm/src/hugegraph_llm/utils/log.py:
##########
@@ -44,16 +45,46 @@
uvicorn_logger = logging.getLogger("uvicorn")
uvicorn_logger.handlers.clear()
uvicorn_logger.handlers.extend(root_logger.handlers)
-uvicorn_logger.setLevel(INFO)
+uvicorn_logger.setLevel(WARNING) # Change to WARNING to reduce output
+
+# Also configure uvicorn.access and uvicorn.error
+uvicorn_access = logging.getLogger("uvicorn.access")
+uvicorn_access.handlers.clear()
+uvicorn_access.handlers.extend(root_logger.handlers)
+uvicorn_access.setLevel(WARNING) # Only show warnings and errors
+
+uvicorn_error = logging.getLogger("uvicorn.error")
+uvicorn_error.handlers.clear()
+uvicorn_error.handlers.extend(root_logger.handlers)
+uvicorn_error.setLevel(WARNING) # Only show warnings and errors
# Configure Gradio logging
-gradio_logger = logging.getLogger("gradio")
-gradio_logger.handlers.clear() # remove default handlers
-gradio_logger.handlers.extend(root_logger.handlers)
-gradio_logger.setLevel(INFO)
+# gradio_logger = logging.getLogger("gradio")
+# gradio_logger.handlers.clear() # remove default handlers
+# gradio_logger.handlers.extend(root_logger.handlers)
+# gradio_logger.setLevel(WARNING)
# Suppress `watchfiles` logging
watchfiles_logger = logging.getLogger("watchfiles")
watchfiles_logger.handlers.clear()
watchfiles_logger.handlers.extend(root_logger.handlers)
watchfiles_logger.setLevel(logging.ERROR)
+
+# Suppress third-party libraries logging
+third_party_loggers = {
+ "httpx": WARNING, # HTTP client library (general HTTP requests)
+ "httpcore": WARNING, # HTTP core library
+ "faiss": WARNING, # Vector search library
+ "faiss.loader": WARNING, # Faiss loader
+ "apscheduler": WARNING, # Task scheduler
+ "apscheduler.scheduler": WARNING,
+ "apscheduler.executors": WARNING,
+ "pyhugegraph": INFO, # PyHugeGraph client
+ "urllib3": WARNING, # URL library
+ "requests": WARNING, # Requests library
+ "gradio": WARNING, # Already configured above
Review Comment:
The comment 'Already configured above' is misleading since the gradio logger
configuration is commented out above. This creates confusion about the actual
configuration state.
##########
hugegraph-llm/src/hugegraph_llm/utils/log.py:
##########
@@ -44,16 +45,46 @@
uvicorn_logger = logging.getLogger("uvicorn")
uvicorn_logger.handlers.clear()
uvicorn_logger.handlers.extend(root_logger.handlers)
-uvicorn_logger.setLevel(INFO)
+uvicorn_logger.setLevel(WARNING) # Change to WARNING to reduce output
+
+# Also configure uvicorn.access and uvicorn.error
+uvicorn_access = logging.getLogger("uvicorn.access")
+uvicorn_access.handlers.clear()
+uvicorn_access.handlers.extend(root_logger.handlers)
+uvicorn_access.setLevel(WARNING) # Only show warnings and errors
+
+uvicorn_error = logging.getLogger("uvicorn.error")
+uvicorn_error.handlers.clear()
+uvicorn_error.handlers.extend(root_logger.handlers)
+uvicorn_error.setLevel(WARNING) # Only show warnings and errors
# Configure Gradio logging
-gradio_logger = logging.getLogger("gradio")
-gradio_logger.handlers.clear() # remove default handlers
-gradio_logger.handlers.extend(root_logger.handlers)
-gradio_logger.setLevel(INFO)
+# gradio_logger = logging.getLogger("gradio")
+# gradio_logger.handlers.clear() # remove default handlers
+# gradio_logger.handlers.extend(root_logger.handlers)
+# gradio_logger.setLevel(WARNING)
Review Comment:
The gradio logger configuration is commented out but still referenced in the
third_party_loggers dictionary below. Either remove the commented code or
uncomment it to maintain consistency.
```suggestion
gradio_logger = logging.getLogger("gradio")
gradio_logger.handlers.clear() # remove default handlers
gradio_logger.handlers.extend(root_logger.handlers)
gradio_logger.setLevel(WARNING)
```
##########
hugegraph-llm/src/hugegraph_llm/utils/log.py:
##########
@@ -44,16 +45,46 @@
uvicorn_logger = logging.getLogger("uvicorn")
uvicorn_logger.handlers.clear()
uvicorn_logger.handlers.extend(root_logger.handlers)
-uvicorn_logger.setLevel(INFO)
+uvicorn_logger.setLevel(WARNING) # Change to WARNING to reduce output
+
+# Also configure uvicorn.access and uvicorn.error
+uvicorn_access = logging.getLogger("uvicorn.access")
+uvicorn_access.handlers.clear()
+uvicorn_access.handlers.extend(root_logger.handlers)
+uvicorn_access.setLevel(WARNING) # Only show warnings and errors
+
+uvicorn_error = logging.getLogger("uvicorn.error")
+uvicorn_error.handlers.clear()
+uvicorn_error.handlers.extend(root_logger.handlers)
+uvicorn_error.setLevel(WARNING) # Only show warnings and errors
# Configure Gradio logging
-gradio_logger = logging.getLogger("gradio")
-gradio_logger.handlers.clear() # remove default handlers
-gradio_logger.handlers.extend(root_logger.handlers)
-gradio_logger.setLevel(INFO)
+# gradio_logger = logging.getLogger("gradio")
+# gradio_logger.handlers.clear() # remove default handlers
+# gradio_logger.handlers.extend(root_logger.handlers)
+# gradio_logger.setLevel(WARNING)
# Suppress `watchfiles` logging
watchfiles_logger = logging.getLogger("watchfiles")
watchfiles_logger.handlers.clear()
watchfiles_logger.handlers.extend(root_logger.handlers)
watchfiles_logger.setLevel(logging.ERROR)
+
+# Suppress third-party libraries logging
+third_party_loggers = {
+ "httpx": WARNING, # HTTP client library (general HTTP requests)
+ "httpcore": WARNING, # HTTP core library
+ "faiss": WARNING, # Vector search library
+ "faiss.loader": WARNING, # Faiss loader
+ "apscheduler": WARNING, # Task scheduler
+ "apscheduler.scheduler": WARNING,
+ "apscheduler.executors": WARNING,
+ "pyhugegraph": INFO, # PyHugeGraph client
Review Comment:
[nitpick] The pyhugegraph logger is set to INFO level while other
third-party libraries are set to WARNING. Consider adding a comment explaining
why this library should remain at INFO level, or use a constant like the others
for consistency.
```suggestion
"pyhugegraph": INFO, # PyHugeGraph client: Set to INFO to capture
detailed logs for debugging purposes
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]