Wrap the FSM action function providing extended logging information based on doc string.

def action(func):
    """Wrap the FSM action function providing extended logging information based on doc string."""
    @wraps(func)
    def call_action(*args, **kwargs):
        """Wrap the function with logger debug."""
        try:
            ctx = kwargs['ctx']
        except KeyError:
            ctx = None

        if ctx is None:
            try:
                ctx = args[-1]
            except IndexError:
                ctx = None
        if ctx:
            if func.__doc__ is None:
                ctx.device.chain.connection.log("A={}".format(func.__name__))
            else:
                ctx.device.chain.connection.log("A={}".format(func.__doc__.split('\n', 1)[0]))
        return func(*args, **kwargs)
    return call_action