def format_prefix(meta):
    """Format log metadata as a prefix to be prepended to log lines."""
    ts = meta.time.strftime('%H:%M:%S.%f')[:-3]
    if meta.comm and meta.pid:
        return "%s %s[%d]: " % (ts, meta.comm, meta.pid)
    else:
        return ts + ": "