def log_nodes_cb(node, status):
    """
    Record node run statistics to a log file as json dictionaries.

    Parameters
    ----------
    node : nipype.pipeline.engine.Node
        the node being logged
    status : string
        acceptable values are 'start', 'end'; otherwise it is
        considered and error

    Returns
    -------
    None
        this function does not return any values, it logs the node
        status info to the callback logger

    """
    if status != 'end':
        return
    import logging
    import json
    status_dict = {'name': node.name, 'id': node._id, 'start': getattr(node
        .result.runtime, 'startTime'), 'finish': getattr(node.result.
        runtime, 'endTime'), 'duration': getattr(node.result.runtime,
        'duration'), 'runtime_threads': getattr(node.result.runtime,
        'cpu_percent', 'N/A'), 'runtime_memory_gb': getattr(node.result.
        runtime, 'mem_peak_gb', 'N/A'), 'estimated_memory_gb': node.mem_gb,
        'num_threads': node.n_procs}
    if status_dict['start'] is None or status_dict['finish'] is None:
        status_dict['error'] = True
    logging.getLogger('callback').debug(json.dumps(status_dict))
