Debugging & Logging

The globalMOO SDKs provide extensive debugging and logging capabilities to help troubleshoot integration issues.

Debug Mode

Enable debug mode for detailed logging of API interactions:

from globalmoo.client import Client
import logging

# Configure logging
logging.basicConfig(
    level=logging.DEBUG,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)

# Create client with debug mode
client = Client(debug=True)

Debug mode will log:

  • Request URLs and methods

  • Request headers and bodies

  • Response status codes

  • Response headers and bodies

  • Validation errors

  • SDK operations

Log Levels

The SDKs use these standard log levels:

Level
Description
Examples

DEBUG

Detailed troubleshooting

Request/response bodies, validation details

INFO

General operations

Request initiated, response received

WARNING

Potential issues

Rate limit warning, retry attempt

ERROR

Operation failures

Network error, invalid response

Custom Logging

Configure custom logging behavior:

What Gets Logged

With debug mode enabled, the SDKs log:

  1. Request Information

    • HTTP method and URL

    • Request headers

    • Request body

    • Query parameters

  2. Response Information

    • Status code

    • Response headers

    • Response body

    • Timing information

  3. SDK Operations

    • Object creation

    • Validation steps

    • Data transformations

    • Error handling

  4. Performance Metrics

    • Request duration

    • Suggestion time

    • Computation time

    • Network latency

Log Output Example

Best Practices

  1. Log Management

    • Use log rotation to manage file size

    • Clean up old log files

    • Consider log aggregation for production

    • Monitor log volume

  2. Security

    • Never log API keys or credentials

    • Redact sensitive information

    • Secure log file permissions

    • Follow data privacy regulations

  3. Performance

    • Use appropriate log levels

    • Consider logging impact

    • Buffer log writes

    • Compress old logs

  4. Troubleshooting

    • Include correlation IDs

    • Log context information

    • Use structured logging

    • Add timing information

Last updated