feat: 이벤트 로깅 시스템 추가 및 주요 컴포넌트 로깅 통합
This commit is contained in:
@@ -3,6 +3,7 @@ import json
|
||||
from model_downloader import download_model
|
||||
from ai_agent import AIAgent
|
||||
import argparse
|
||||
from event_logger import init_from_config, get_logger
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='AI 웹 정보 수집 시스템')
|
||||
@@ -19,8 +20,10 @@ def main():
|
||||
with open(args.config, 'r') as f:
|
||||
config = json.load(f)
|
||||
|
||||
# 2. 모델 다운로드 (필요한 경우)
|
||||
# 2. 로깅 초기화 및 모델 다운로드 (필요한 경우)
|
||||
logger = init_from_config(config)
|
||||
print("모델 확인 중...")
|
||||
logger.log_event("model_check")
|
||||
model, tokenizer = download_model(args.config)
|
||||
|
||||
# 모델 로딩은 AIAgent에서 수행하므로, 다운로드만 성공해도 계속 진행
|
||||
@@ -42,22 +45,28 @@ def main():
|
||||
with open(args.config, 'w') as f:
|
||||
json.dump(config, f, indent=2)
|
||||
print(f"저장 경로 설정됨: {args.save_path}")
|
||||
logger.log_event("save_path_set", path=args.save_path)
|
||||
|
||||
# 3. AI 에이전트 초기화
|
||||
print("AI 에이전트 초기화 중...")
|
||||
logger.log_event("agent_init_start")
|
||||
agent = AIAgent(args.config)
|
||||
logger.log_event("agent_init_done")
|
||||
|
||||
# 3. 주제 결정
|
||||
if args.auto_topics or args.topics is None:
|
||||
print("AI가 스스로 주제를 선정합니다...")
|
||||
topics = agent.generate_topics(num_topics=3)
|
||||
print(f"선정된 주제: {topics}")
|
||||
logger.log_event("auto_topics", topics=topics)
|
||||
else:
|
||||
topics = args.topics
|
||||
logger.log_event("user_topics", topics=topics)
|
||||
|
||||
# 4. 정보 수집 실행
|
||||
print(f"다음 주제들에 대해 정보를 수집합니다: {topics}")
|
||||
results = agent.collect_information(topics)
|
||||
logger.log_event("collect_done", topic_count=len(topics))
|
||||
|
||||
# 5. 결과 출력
|
||||
print("\n=== 수집 결과 ===")
|
||||
@@ -68,6 +77,7 @@ def main():
|
||||
|
||||
# 6. 정리
|
||||
agent.close()
|
||||
logger.log_event("run_complete", message="Program finished")
|
||||
print("프로그램 완료")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user