#!/usr/bin/env python3
from pprint import pformat as pp

from phi.config import get_config
from phi.logging import setup_logging, get_logger
from phi.app import setup_app, run_app

log = get_logger(__name__)


if __name__ == '__main__':
    config_file, config = get_config()

    # Beware that everything happened until now
    # could not possibly get logged.
    setup_logging(config.get('logging', {}))

    log.info("Found configuration at '{}':\n{}"
             .format(config_file, pp(config)))

    app = setup_app(config)
    run_app(app)