def get_user_log_syntax_map(log_text):
    """Return dict mapping portions to respective categories.

    That is, we map each portion of the text to the name
    of the category that portion represents in the syntax.

    By the way, a user log is just the content of a special
    logger called user logger.

    A user log has 05 categories, which are normal
    text ('normal') and log headers of different levels
    ('info_header', 'warning_header', 'error_header' and
    'critical_header').

    The dict itself contains indices of lines from the text
    mapped to another dict which contains the intervals in
    that line mapped to the category of text each interval
    contain.

    The intervals are 2-tuples of integers representing
    the [a, b) interval. Another way of seeing such
    integers is as the indices you'd use to grab the
    slice of text from the line representing the interval:
    line_text[a:b].

    For instance, if a line has the (0, 4) interval mapped
    to 'normal', it means the line text has normal text
    from the index 0 until the index 3. If you were to
    execute line_text[0, 4] you'd get a normal portion
    of text.


    Doctest
    =======

    An example in the form of a doctest can be seen below:

    >>> # TODO remember to check whether the "new line
    >>> # problem" below has already been reported as bug

    >>> # for some reason, using the new line character
    >>> # directly was causing the text to raise an error,
    >>> # so we obtain it here indirectly
    >>> NEW_LINE = chr(10)

    >>> line0 = "--- [INFO message logged at 15:22:03] ---"
    >>> line1 = "A log message"
    >>> text = NEW_LINE.join((line0, line1))
    >>> expected_output = {
    ...   0: {
    ...        (0, 41) : 'info_header'
    ...      },
    ...   1: {
    ...        (0, 13) : 'normal'
    ...      }
    ... }
    >>> get_user_log_syntax_map(text) == expected_output
    True

    In other words, the output means that the text we
    provided, in its first line (index 0), has info log
    header text from the index 0 until the 33 (the entire
    line), and the following line (index 1) has normal text
    from the character at the index 0 until the index 8
    (again, the whole line).


    No Syntax Errors
    ================

    This function wasn't set to raise SyntaxMappingError
    as was the case for the equivalent function which maps
    syntax for Python source code, for instance.

    This is so because logs don't have wrong syntax.
    They either have special syntax (header text) or no
    syntax at all, but we don't expect any syntax-related
    errors to be raised while mapping syntax for logs from
    the user logger.
    """
    ### return dict

    return {
        ### each item in such dict is composed by the index of
        ### a line to which a dict is mapped
        line_index: {
            ## this other dict associates the interval
            ## representing the whole line to the category
            ## to which its content belongs
            (0, len(line_text)): get_log_category(line_text)
        }
        ### we grab pairs of line index/ line text from lines
        ### which are not empty
        for line_index, line_text in enumerate(log_text.splitlines())
        if line_text
    }
Return dict mapping portions to respective categories.

    That is, we map each portion of the text to the name
    of the category that portion represents in the syntax.

    By the way, a user log is just the content of a special
    logger called user logger.

    A user log has 05 categories, which are normal
    text ('normal') and log headers of different levels
    ('info_header', 'warning_header', 'error_header' and
    'critical_header').

    The dict itself contains indices of lines from the text
    mapped to another dict which contains the intervals in
    that line mapped to the category of text each interval
    contain.

    The intervals are 2-tuples of integers representing
    the [a, b) interval. Another way of seeing such
    integers is as the indices you'd use to grab the
    slice of text from the line representing the interval:
    line_text[a:b].

    For instance, if a line has the (0, 4) interval mapped
    to 'normal', it means the line text has normal text
    from the index 0 until the index 3. If you were to
    execute line_text[0, 4] you'd get a normal portion
    of text.


    Doctest
    =======

    An example in the form of a doctest can be seen below:

    >>> # TODO remember to check whether the "new line
    >>> # problem" below has already been reported as bug

    >>> # for some reason, using the new line character
    >>> # directly was causing the text to raise an error,
    >>> # so we obtain it here indirectly
    >>> NEW_LINE = chr(10)

    >>> line0 = "--- [INFO message logged at 15:22:03] ---"
    >>> line1 = "A log message"
    >>> text = NEW_LINE.join((line0, line1))
    >>> expected_output = {
    ...   0: {
    ...        (0, 41) : 'info_header'
    ...      },
    ...   1: {
    ...        (0, 13) : 'normal'
    ...      }
    ... }
    >>> get_user_log_syntax_map(text) == expected_output
    True

    In other words, the output means that the text we
    provided, in its first line (index 0), has info log
    header text from the index 0 until the 33 (the entire
    line), and the following line (index 1) has normal text
    from the character at the index 0 until the index 8
    (again, the whole line).


    No Syntax Errors
    ================

    This function wasn't set to raise SyntaxMappingError
    as was the case for the equivalent function which maps
    syntax for Python source code, for instance.

    This is so because logs don't have wrong syntax.
    They either have special syntax (header text) or no
    syntax at all, but we don't expect any syntax-related
    errors to be raised while mapping syntax for logs from
    the user logger.
    
nodezator/syntaxman/syntaxes/userlog.py