{% from "leeuwenhoek/_macros.html" import duration, time_ago %} {% macro error_tag(err) %}{% if err %}{{ err['class'].split('.')[-1] }}{% endif %}{% endmacro %} {% macro command_tag(c) %}{{ c.command }}{% if c.command == "PIPELINE" %} {{ c.count }} command{{ 's' if c.count != 1 }}{% endif %}{% endmacro %} {% macro args_text(c) %}{% if c.command == "PIPELINE" %}{{ c.commands | map(attribute='command') | join(", ") }}{% else %}{{ c.args | join(" ") }}{% endif %}{% endmacro %} {% macro head() %}CommandArgumentsServerDurationWhen{% endmacro %} {% macro row(e) %} {{ command_tag(e.content) }} {{ error_tag(e.content.error) }} {{ args_text(e.content) | lw_truncate(90) }} {{ e.content.host or '—' }}{% if e.content.db is not none %}/{{ e.content.db }}{% endif %} {{ duration(e.content.duration_ms) }} {{ time_ago(e.created_at) }} {% endmacro %} {% macro summary(e) %}{{ command_tag(e.content) }} {{ args_text(e.content) | lw_truncate(90) }} {{ error_tag(e.content.error) }} {{ duration(e.content.duration_ms) }}{% endmacro %} {% macro arg_list(c) -%} {%- for a in c.args %}{{ a }} {% endfor -%} {%- if c.args_omitted %}… {{ c.args_omitted }} more{% endif -%} {%- endmacro %} {% macro detail(e) %} {% set c = e.content %}

Command

{{ c.command }}

Duration

{{ c.duration_ms | lw_duration }}

Server

{{ c.host or '—' }}

Database

{{ c.db if c.db is not none else '—' }}

Client

{{ 'async' if c['async'] else 'sync' }}

{% if c.error %}
{{ c.error['class'] }}: {{ c.error.message }}
{% endif %} {% if c.command == "PIPELINE" %}

{{ c.count }} command{{ 's' if c.count != 1 }}{% if c.transaction %} in a transaction (MULTI / EXEC){% endif %}

{% for cmd in c.commands %} {% endfor %}
#CommandArguments
{{ loop.index }}{{ cmd.command }} {{ error_tag(cmd.error) }}{{ arg_list(cmd) }}
{% if c.commands_omitted %}

… {{ c.commands_omitted }} more commands not recorded

{% endif %} {% else %}

Arguments

{% if c.args %}{{ arg_list(c) }}{% else %}none{% endif %}

{% endif %} {% endmacro %}