Using Logger Support for Debugging
- Getting Started
- Bot Building
- Smart Agent Chat
- Conversation Design
-
Developer Guides
Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
- Deployment
- External Agent Tool Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Logger support in Code Executor
You can use the standard python logging library inside the code editor. See the below snippet for reference
import json
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def main(event, context):
final_response = {'status': True}
logger.info(final_response)
response = {'statusCode': 200, 'body': json.dumps(final_response), 'headers': {'Content-Type': 'application/json'}}
return response
def get_replacement_orders(self):
user_id = self.entities.get("phone_number")[0].get("entity_value")
base_url = f'<URL>'
url = f'<URL>'
payload = {
"user_id": user_id
}
headers = {
"Content-Type": "application/json"
}
logger.info(f'Getting Replacement Orders from {url}')
logger.info(f'Headers {headers}')
logger.info(f'Request Body {payload}')
response = requests.post(url, headers=headers, json = payload, timeout = 5)
logger.info(f'Response {response} {response.text}')
response.raise_for_status()
return response.json()