# Buggy code
def get_hello(request):
    """Return information regarding the current instance."""
    settings = request.registry.settings
    project_name = settings["project_name"]
    project_version = settings["project_version"]
    data = dict(
        project_name=project_name,
        project_version=project_version,
        http_api_version=settings["http_api_version"],
        project_docs=settings["project_docs"],
        cliquet_protocol_version=PROTOCOL_VERSION,
        url=request.route_url(hello.name),
    )

    eos = get_eos(request)
    if eos:
        data["eos"] = eos

    data["settings"] = {}
    public_settings = request.registry.public_settings
    # Public settings will be prefixed with project name, unless explicitly
    # specified with cliquet. (for retrocompability of clients for example).
    for setting in list(public_settings):
        if setting.startswith("cliquet."):
            unprefixed = setting.replace("cliquet.", "", 1)
            value = settings[unprefixed]
        elif setting.startswith(project_name + "."):
            unprefixed = setting.replace(project_name + ".", "")
            value = settings[unprefixed]
        else:
            value = settings[setting]
        data["settings"][setting] = value

    prefixed_userid = getattr(request, "prefixed_userid", None)
    if prefixed_userid:
        data["user"] = request.get_user_info()

    return data


# Traceback (AttributeError)
kinto start
event='Backend settings referring to cliquet are DEPRECATED. Please update your kinto.cache_backend setting to kinto.core.cache.memory (was: cliquet.cache.memory).'
event='Backend settings referring to cliquet are DEPRECATED. Please update your kinto.permission_backend setting to kinto.core.permission.memory (was: cliquet.permission.memory).'
event='Backend settings referring to cliquet are DEPRECATED. Please update your kinto.storage_backend setting to kinto.core.storage.memory (was: cliquet.storage.memory).'
Traceback (most recent call last):
File "/home/mathieu/Code/Mozilla/kinto/.venv/bin/kinto", line 9, in <module>
load_entry_point('kinto', 'console_scripts', 'kinto')()
File "/home/mathieu/Code/Mozilla/kinto/kinto/__main__.py", line 97, in main
pserve.main(pserve_argv)
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 60, in main
return command.run()
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 371, in run
global_conf=vars)
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 406, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
File "/home/mathieu/Code/Mozilla/kinto/.venv/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/home/mathieu/Code/Mozilla/kinto/.venv/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/home/mathieu/Code/Mozilla/kinto/.venv/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/home/mathieu/Code/Mozilla/kinto/.venv/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/home/mathieu/Code/Mozilla/kinto/.venv/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/util.py", line 55, in fix_call
val = callable(*args, **kw)
File "/home/mathieu/Code/Mozilla/kinto/kinto/__init__.py", line 44, in main
default_settings=DEFAULT_SETTINGS)
File "/home/mathieu/Code/Mozilla/kinto/kinto/core/initialization.py", line 553, in initialize
config.include("kinto.core", route_prefix=api_version)
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 800, in include
c(configurator)
File "/home/mathieu/Code/Mozilla/kinto/kinto/core/__init__.py", line 176, in includeme
logger.info(msg % settings)
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/structlog/stdlib.py", line 67, in info
return self._proxy_to_logger('info', event, *args, **kw)
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/structlog/stdlib.py", line 119, in _proxy_to_logger
**event_kw)
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/structlog/_base.py", line 176, in _proxy_to_logger
args, kw = self._process_event(method_name, event, event_kw)
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/structlog/_base.py", line 136, in _process_event
event_dict = proc(self._logger, method_name, event_dict)
File "/home/mathieu/Code/Mozilla/kinto/.venv/local/lib/python2.7/site-packages/structlog/stdlib.py", line 327, in filter_by_level
if logger.isEnabledFor(_NAME_TO_LEVEL[name]):
AttributeError: 'PrintLogger' object has no attribute 'isEnabledFor'

# Fixed code
def get_hello(request):
    """Return information regarding the current instance."""
    settings = request.registry.settings
    project_name = settings["project_name"]
    project_version = settings["project_version"]
    data = dict(
        project_name=project_name,
        project_version=project_version,
        http_api_version=settings["http_api_version"],
        project_docs=settings["project_docs"],
        cliquet_protocol_version=PROTOCOL_VERSION,
        url=request.route_url(hello.name),
    )

    eos = get_eos(request)
    if eos:
        data["eos"] = eos

    data["settings"] = {}
    public_settings = request.registry.public_settings
    # Public settings will be prefixed with project name, unless explicitly
    # specified with cliquet. (for retrocompability of clients for example).
    for setting in list(public_settings):
        if setting.startswith("cliquet."):
            unprefixed = setting.replace("cliquet.", "", 1)
            value = settings[unprefixed]
        elif setting.startswith(project_name + "."):
            unprefixed = setting.replace(project_name + ".", "")
            value = settings[unprefixed]
        else:
            value = settings[setting]
        data["settings"][setting] = value

    prefixed_userid = getattr(request, "prefixed_userid", None)
    if prefixed_userid:
        data["user"] = request.get_user_info()

    # Application can register and expose arbitrary capabilities.
    data["capabilities"] = request.registry.api_capabilities

    return data