Add FastMCP tool for web scrapping.
Add logging info for tools calling
This commit is contained in:
+5
-2
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import sys
|
||||
from xmlrpc.client import boolean
|
||||
|
||||
|
||||
@@ -12,13 +13,15 @@ def simple_logger(log_relative_path = str, printToConsole = boolean, logger_name
|
||||
|
||||
formatter = logging.Formatter(fmt="%(asctime)s [%(levelname)s] %(message)s",
|
||||
datefmt="%Y-%m-%d %H:%M:%S")
|
||||
file_handler = logging.FileHandler(log_relative_path)
|
||||
file_handler = logging.FileHandler(log_relative_path, encoding="utf-8")
|
||||
file_handler.setFormatter(formatter)
|
||||
file_handler.setLevel(logging.INFO)
|
||||
logger.addHandler(file_handler)
|
||||
|
||||
if printToConsole:
|
||||
console_handler = logging.StreamHandler()
|
||||
# 2. Force StreamHandler to use sys.stdout with utf-8 encoding
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
console_handler = logging.StreamHandler(sys.stdout)
|
||||
console_handler.setFormatter(formatter)
|
||||
console_handler.setLevel(logging.INFO)
|
||||
logger.addHandler(console_handler)
|
||||
|
||||
Reference in New Issue
Block a user