Logger fixes

This commit is contained in:
2025-02-26 20:09:06 +00:00
parent ee9c82f096
commit db9c538d8a
4 changed files with 13 additions and 12 deletions

View File

@@ -5,17 +5,17 @@ This module contains the LLMClient class that supports multiple LLM providers
(OpenAI, Anthropic, OpenRouter) through a unified interface.
"""
import logging
import traceback
from typing import Any
from airflow.utils.log.logging_mixin import LoggingMixin
from flask import session
from airflow_wingman.providers import create_llm_provider
from airflow_wingman.tools import list_airflow_tools
# Create a logger instance
logger = LoggingMixin().log
# Create a properly namespaced logger for the Airflow plugin
logger = logging.getLogger("airflow.plugins.wingman")
class LLMClient:
@@ -102,7 +102,7 @@ class LLMClient:
return {"content": self.provider.get_content(response)}
except Exception as e:
error_msg = f"Error in {self.provider_name} API call: {str(e)}\\n{traceback.format_exc()}"
error_msg = f"Error in {self.provider_name} API call: {str(e)}\n{traceback.format_exc()}"
logger.error(error_msg)
return {"error": f"API request failed: {str(e)}"}

View File

@@ -5,17 +5,18 @@ This module contains the Anthropic provider implementation that handles
API requests, tool conversion, and response processing for Anthropic's Claude models.
"""
import logging
import traceback
from typing import Any
from airflow.utils.log.logging_mixin import LoggingMixin
from anthropic import Anthropic
from airflow_wingman.providers.base import BaseLLMProvider
from airflow_wingman.tools import execute_airflow_tool
from airflow_wingman.tools.conversion import convert_to_anthropic_tools
logger = LoggingMixin().log
# Create a properly namespaced logger for the Airflow plugin
logger = logging.getLogger("airflow.plugins.wingman")
class AnthropicProvider(BaseLLMProvider):

View File

@@ -6,18 +6,18 @@ API requests, tool conversion, and response processing for OpenAI.
"""
import json
import logging
import traceback
from typing import Any
from airflow.utils.log.logging_mixin import LoggingMixin
from openai import OpenAI
from airflow_wingman.providers.base import BaseLLMProvider
from airflow_wingman.tools import execute_airflow_tool
from airflow_wingman.tools.conversion import convert_to_openai_tools
# Create a logger instance
logger = LoggingMixin().log
# Create a properly namespaced logger for the Airflow plugin
logger = logging.getLogger("airflow.plugins.wingman")
class OpenAIProvider(BaseLLMProvider):

View File

@@ -6,15 +6,15 @@ This module contains functions to list and execute Airflow tools.
import asyncio
import json
import logging
import traceback
from airflow import configuration
from airflow.utils.log.logging_mixin import LoggingMixin
from airflow_mcp_server.config import AirflowConfig
from airflow_mcp_server.tools.tool_manager import get_airflow_tools, get_tool
# Create a logger instance
logger = LoggingMixin().log
# Create a properly namespaced logger for the Airflow plugin
logger = logging.getLogger("airflow.plugins.wingman")
async def _list_airflow_tools_async(cookie: str) -> list: