refactor(logging): standardize logging approach across services and steps
This commit is contained in:
@@ -32,23 +32,33 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
body={'error': 'Endpoint required as query parameter'}
|
||||
)
|
||||
|
||||
ctx.logger.info("=" * 80)
|
||||
ctx.logger.info("🔄 ADVOWARE PROXY: DELETE REQUEST")
|
||||
ctx.logger.info("=" * 80)
|
||||
ctx.logger.info(f"Endpoint: {endpoint}")
|
||||
ctx.logger.info("=" * 80)
|
||||
|
||||
# Initialize Advoware client
|
||||
advoware = AdvowareAPI(ctx)
|
||||
|
||||
# Forward all query params except 'endpoint'
|
||||
params = {k: v for k, v in request.query_params.items() if k != 'endpoint'}
|
||||
|
||||
ctx.logger.info(f"Proxying DELETE request to Advoware: {endpoint}")
|
||||
result = await advoware.api_call(
|
||||
endpoint,
|
||||
method='DELETE',
|
||||
params=params
|
||||
)
|
||||
|
||||
ctx.logger.info("✅ Proxy DELETE erfolgreich")
|
||||
return ApiResponse(status=200, body={'result': result})
|
||||
|
||||
except Exception as e:
|
||||
ctx.logger.error(f"Proxy error: {e}")
|
||||
ctx.logger.error("=" * 80)
|
||||
ctx.logger.error("❌ ADVOWARE PROXY DELETE FEHLER")
|
||||
ctx.logger.error(f"Endpoint: {request.query_params.get('endpoint', 'N/A')}")
|
||||
ctx.logger.error(f"Error: {e}")
|
||||
ctx.logger.error("=" * 80)
|
||||
return ApiResponse(
|
||||
status=500,
|
||||
body={'error': 'Internal server error', 'details': str(e)}
|
||||
|
||||
@@ -32,23 +32,33 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
body={'error': 'Endpoint required as query parameter'}
|
||||
)
|
||||
|
||||
ctx.logger.info("=" * 80)
|
||||
ctx.logger.info("🔄 ADVOWARE PROXY: GET REQUEST")
|
||||
ctx.logger.info("=" * 80)
|
||||
ctx.logger.info(f"Endpoint: {endpoint}")
|
||||
ctx.logger.info("=" * 80)
|
||||
|
||||
# Initialize Advoware client
|
||||
advoware = AdvowareAPI(ctx)
|
||||
|
||||
# Forward all query params except 'endpoint'
|
||||
params = {k: v for k, v in request.query_params.items() if k != 'endpoint'}
|
||||
|
||||
ctx.logger.info(f"Proxying GET request to Advoware: {endpoint}")
|
||||
result = await advoware.api_call(
|
||||
endpoint,
|
||||
method='GET',
|
||||
params=params
|
||||
)
|
||||
|
||||
ctx.logger.info("✅ Proxy GET erfolgreich")
|
||||
return ApiResponse(status=200, body={'result': result})
|
||||
|
||||
except Exception as e:
|
||||
ctx.logger.error(f"Proxy error: {e}")
|
||||
ctx.logger.error("=" * 80)
|
||||
ctx.logger.error("❌ ADVOWARE PROXY GET FEHLER")
|
||||
ctx.logger.error(f"Endpoint: {request.query_params.get('endpoint', 'N/A')}")
|
||||
ctx.logger.error(f"Error: {e}")
|
||||
ctx.logger.error("=" * 80)
|
||||
return ApiResponse(
|
||||
status=500,
|
||||
body={'error': 'Internal server error', 'details': str(e)}
|
||||
|
||||
@@ -34,6 +34,12 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
body={'error': 'Endpoint required as query parameter'}
|
||||
)
|
||||
|
||||
ctx.logger.info("=" * 80)
|
||||
ctx.logger.info("🔄 ADVOWARE PROXY: POST REQUEST")
|
||||
ctx.logger.info("=" * 80)
|
||||
ctx.logger.info(f"Endpoint: {endpoint}")
|
||||
ctx.logger.info("=" * 80)
|
||||
|
||||
# Initialize Advoware client
|
||||
advoware = AdvowareAPI(ctx)
|
||||
|
||||
@@ -43,7 +49,6 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
# Get request body
|
||||
json_data = request.body
|
||||
|
||||
ctx.logger.info(f"Proxying POST request to Advoware: {endpoint}")
|
||||
result = await advoware.api_call(
|
||||
endpoint,
|
||||
method='POST',
|
||||
@@ -51,11 +56,17 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
json_data=json_data
|
||||
)
|
||||
|
||||
ctx.logger.info("✅ Proxy POST erfolgreich")
|
||||
return ApiResponse(status=200, body={'result': result})
|
||||
|
||||
except Exception as e:
|
||||
ctx.logger.error(f"Proxy error: {e}")
|
||||
ctx.logger.error("=" * 80)
|
||||
ctx.logger.error("❌ ADVOWARE PROXY POST FEHLER")
|
||||
ctx.logger.error(f"Endpoint: {request.query_params.get('endpoint', 'N/A')}")
|
||||
ctx.logger.error(f"Error: {e}")
|
||||
ctx.logger.error("=" * 80)
|
||||
return ApiResponse(
|
||||
status=500,
|
||||
body={'error': 'Internal server error', 'details': str(e)}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -34,6 +34,12 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
body={'error': 'Endpoint required as query parameter'}
|
||||
)
|
||||
|
||||
ctx.logger.info("=" * 80)
|
||||
ctx.logger.info("🔄 ADVOWARE PROXY: PUT REQUEST")
|
||||
ctx.logger.info("=" * 80)
|
||||
ctx.logger.info(f"Endpoint: {endpoint}")
|
||||
ctx.logger.info("=" * 80)
|
||||
|
||||
# Initialize Advoware client
|
||||
advoware = AdvowareAPI(ctx)
|
||||
|
||||
@@ -43,7 +49,6 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
# Get request body
|
||||
json_data = request.body
|
||||
|
||||
ctx.logger.info(f"Proxying PUT request to Advoware: {endpoint}")
|
||||
result = await advoware.api_call(
|
||||
endpoint,
|
||||
method='PUT',
|
||||
@@ -51,11 +56,17 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
json_data=json_data
|
||||
)
|
||||
|
||||
ctx.logger.info("✅ Proxy PUT erfolgreich")
|
||||
return ApiResponse(status=200, body={'result': result})
|
||||
|
||||
except Exception as e:
|
||||
ctx.logger.error(f"Proxy error: {e}")
|
||||
ctx.logger.error("=" * 80)
|
||||
ctx.logger.error("❌ ADVOWARE PROXY PUT FEHLER")
|
||||
ctx.logger.error(f"Endpoint: {request.query_params.get('endpoint', 'N/A')}")
|
||||
ctx.logger.error(f"Error: {e}")
|
||||
ctx.logger.error("=" * 80)
|
||||
return ApiResponse(
|
||||
status=500,
|
||||
body={'error': 'Internal server error', 'details': str(e)}
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user