def log(logcall, string, lock=None):
    """
    Report an information/warning/error/debug... message with a logger instance
    but taken into account a lock if given.

    :param logcall: call of the logger to perform.
    :type logcall: method
    :param string: string to pass by argument to the call.
    :type string: str
    :param lock: possible lock instance.
    :type lock: multiprocessing.Lock
    """
    if lock:
        lock.acquire()
        logcall(string)
        lock.release()
    else:
        logcall(string)
