{% macro js() %}
  <!-- voila log js -->
  <script>
    const _debug = console.debug;
    const _info = console.info;
    const _warn = console.warn;
    const _error = console.error;

    console.debug = (...args) => {
        window.top.postMessage({ level: "debug", msg: ["[Voilà]:", ...args] });
        _debug(...args);
    };

    console.info = console.info = (...args) => {
        window.top.postMessage({ level: "info", msg: ["[Voilà]:", ...args] });
        _info(...args);
    };

    console.warn = (...args) => {
        window.top.postMessage({ level: "warn", msg: ["[Voilà]:", ...args] });
        _warn(...args);
    };

    console.error = (...args) => {
        window.top.postMessage({ level: "error", msg: ["[Voilà]:", ...args] });
        _error(...args);
    };
    
    //console.log("test");
    //console.debug("debug");
    //console.info("info");
    //console.warn("warn");
    //console.error("error");
  </script>
{% endmacro %}
