def METHOD_NAME(api_object):
    items = []
    # Internal threads never set vars.context, so we will not have a context
    # attribute. RPC threads set context before calling the api, and set
    # context to None after that.
    ctx = getattr(vars, "context", None)
    if not ctx:
        items.append(("from", "internal"))
    else:
        items.append(("from", "%s,%s" % (ctx.client_host, ctx.client_port)))
        if ctx.flow_id:
            items.append(("flow_id", ctx.flow_id))
    # Task exists only for storage verbs
    task = getattr(vars, "task", None)
    if task:
        items.append(("task_id", task.id))
    attributes = getattr(api_object, 'LOG_ATTRIBUTES', {})
    if attributes:
        items.extend([(name, getattr(api_object, attr, '') or '',)
                      for name, attr in attributes.items()])
    return ", ".join(k + "=" + v for k, v in items)