apple muncy commited on
Commit
c5ae361
·
1 Parent(s): 0d959d8

add logging debug

Browse files

Signed-off-by: apple muncy <[email protected]>

Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -12,6 +12,12 @@ from pydantic import BaseModel
12
  from huggingface_hub.inference._mcp.agent import Agent
13
  from dotenv import load_dotenv
14
 
 
 
 
 
 
 
15
  load_dotenv()
16
 
17
  # Configuration
@@ -111,6 +117,7 @@ async def get_agent():
111
  print("🔧 Loading tools...")
112
  await agent_instance.load_tools()
113
  print("✅ Tools loaded successfully")
 
114
  except Exception as e:
115
  print(f"❌ Error creating/loading agent: {str(e)}")
116
  agent_instance = None
@@ -121,7 +128,6 @@ async def get_agent():
121
 
122
  return agent_instance
123
 
124
-
125
  def extract_tags_from_text(text: str) -> List[str]:
126
  """Extract potential tags from discussion text"""
127
  text_lower = text.lower()
 
12
  from huggingface_hub.inference._mcp.agent import Agent
13
  from dotenv import load_dotenv
14
 
15
+ #add logging
16
+ import logging
17
+ logger = logging.getLogger(__name__)
18
+ logging.basicConfig(filename='/home/user/tag.log', encoding='utf-8', level=logging.DEBUG)
19
+ logger.debug(' This message should go to the log file')
20
+ logger.info(' \e[31mSo should this and be red \e[0m')
21
  load_dotenv()
22
 
23
  # Configuration
 
117
  print("🔧 Loading tools...")
118
  await agent_instance.load_tools()
119
  print("✅ Tools loaded successfully")
120
+ logger.info("Tools loaded successfully")
121
  except Exception as e:
122
  print(f"❌ Error creating/loading agent: {str(e)}")
123
  agent_instance = None
 
128
 
129
  return agent_instance
130
 
 
131
  def extract_tags_from_text(text: str) -> List[str]:
132
  """Extract potential tags from discussion text"""
133
  text_lower = text.lower()