Logging

The SDK uses the standard Python logging module to log messages. An example logging configuration can be found below:

my_package/__init__.py
from moveai_mocap.logging.logger import LOGGER_NAME
from logging.config import dictConfig

LOGGING_CONFIG = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'standard': {
            # Configure your formatter as necessary
            'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
        },
    },
    'handlers': {
        'default': {
            # Configure your handler as necessary
            'level': 'DEBUG',
            'formatter': 'standard',
            'class': 'logging.StreamHandler',
            'stream': 'ext://sys.stdout',  # Default is stderr
        },
    },
    'loggers': {
        LOGGER_NAME: {
            'handlers': ['default'],
            'level': 'DEBUG',
            'propagate': False
        },
        # ....add your other loggers here....
    }
}

# Configure python logging using a dictionary-like object
dictConfig(LOGGING_CONFIG)
my_package/provision.py
from moveai_mocap.compute.ec2 import EC2ComputeManager

# Provision an EC2 instance as normal (or use any other part of the SDK).
# Any logging will then use the log config specified above.
ec2_compute = EC2ComputeManager(...)
ec2_compute.provision()