{% macro render_select(name, options, selected, autokey=false) %}
{% endmacro %} {% import _self as macro %} {% set file = grav.uri.query('log') ?: 'grav.log' %} {% set verbose = grav.uri.query('verbose') == 'true' ? true : false %} {% set lines = grav.uri.query('lines') ?: 20 %} {% set logfile = grav.locator.findResource("log://" ~ file) %} {% set logs = logfile ? logviewer.objectTail(logfile, lines|int, false) : [] %} {% set log_files = admin.getLogFiles() %} {% set title = log_files[file] %}
{% set lines_list = {10:'10 entries', 25:'25 entries', 50:'50 entries', 100:'100 entries', 200:'200 entries', 500:'500 entries'} %} {{ macro.render_select('log', log_files, file) }} {{ macro.render_select('verbose', {'false':'Essential Output', 'true':'Verbose Output'}, verbose) }} {{ macro.render_select('lines', lines_list, lines) }}

{{ title }} Output

Display the {{ lines }} most recent entries...

{% for log in logs %} {% if verbose %} {% endif %} {% endfor %}
Date Level Message
{{ log.date|date }} {{ log.level }} {{ log.message }}
 
    {% for tracerow in log.trace %}
  1. {{ tracerow }}
  2. {% endfor %}