{% macro elog(message, level, depth) %}
{% if execute %}
    {% set valid_levels = ["INFO", "WARN", "ERR"] %}
    {% if level not in valid_levels %}
        {{ exceptions.raise_compiler_error("Invalid log level: " ~ level ~ ". Allowed values: " ~ valid_levels | join(", ")) }}
    {% endif %}

    {% if not depth is number or depth < 0 %}
        {{ exception.raise_compiler_error("Depth must be a non-negatibe integer!") }}
    {% endif %}

    {% if level == "INFO" %}
        {% set start_msg = "\033[0m [INFO]: " ~ "*" * depth * 2 %}
    {% elif level == "WARN" %}
        {% set start_msg = "\033[33m [WARN]: " ~ "*" * depth * 2 %}
    {% elif level == "ERR" %}
        {% set start_msg = "\033[31m [ERROR]: " ~ "*" * depth * 2 %}
    {% endif %}

    {{ log(start_msg | trim ~ " " ~ message, info=True)}}

{% endif %}
{% endmacro %}