Entry point for the event lib that starts the logging process

    This function uses the `name` param to find the event class that
    will be processed to log stuff. This name must provide two
    informations separated by a dot: the app name and the event class
    name. Like this:

        >>> name = 'deal.ActionLog'

    The "ActionLog" is a class declared inside the 'deal.events' module
    and this function will raise an `EventNotFoundError` error if it's
    not possible to import the right event class.

    The `data` param *must* be a dictionary, otherwise a `TypeError`
    will be rised. All keys *must* be strings and all values *must* be
    serializable by the `json.dumps` function. If you need to pass any
    unsupported object, you will have to register a serializer
    function. Consult the RFC-00003-serialize-registry for more
    information.

def log(name, data=None):
    """Entry point for the event lib that starts the logging process

    This function uses the `name` param to find the event class that
    will be processed to log stuff. This name must provide two
    informations separated by a dot: the app name and the event class
    name. Like this:

        >>> name = 'deal.ActionLog'

    The "ActionLog" is a class declared inside the 'deal.events' module
    and this function will raise an `EventNotFoundError` error if it's
    not possible to import the right event class.

    The `data` param *must* be a dictionary, otherwise a `TypeError`
    will be rised. All keys *must* be strings and all values *must* be
    serializable by the `json.dumps` function. If you need to pass any
    unsupported object, you will have to register a serializer
    function. Consult the RFC-00003-serialize-registry for more
    information.
    """
    data = data or {}
    data.update(core.get_default_values(data))

    # InvalidEventNameError, EventNotFoundError
    event_cls = core.find_event(name)
    event = event_cls(name, data)
    event.validate()                # ValidationError
    data = core.filter_data_values(data)
    data = ejson.dumps(data)        # TypeError

    # We don't use celery when developing
    if conf.getsetting('DEBUG'):
        core.process(name, data)
    else:
        tasks.process_task.delay(name, data)