1
0
Files
angie-conv-image/angie/snip/log.j2mod
Konstantin Demin 50d0bbeedf conf: improve logging configuration
- both "error_log()" and "access_log()" now support "syslog:" prefix
- "error_log()" supports "stderr" destination
- both "error_log()" and "access_log()" now support "off" destination (with minor notes for "error_log()")
2025-06-06 11:36:17 +03:00

36 lines
865 B
Plaintext

{% macro error_log(dest='error.log', level='warn') %}
{%- if dest == 'off' %}
## not a really disabled log but quiet as less as possible
error_log stderr emerg;
{%- else %}
error_log
{%- if dest == 'stderr' %}
{{ dest }}
{%- elif dest.startswith('syslog:') %}
{{ dest | ngx_esc }}
{%- else %}
{{ join_prefix('/run/ngx/log', dest) | ngx_esc }}
{%- endif %}
{{ level | ngx_esc }};
{%- endif %}
{% endmacro %}
{% macro access_log(dest='access.log', format='main') %}
{%- if dest == 'off' %}
access_log off;
{%- else %}
access_log
{%- if dest.startswith('syslog:') %}
{{ dest | ngx_esc }}
{%- else %}
{{ join_prefix('/run/ngx/log', dest) | ngx_esc }}
{%- endif %}
{{ format | ngx_esc }}
{%- for k, v in kwargs|dictsort %}
{{ "{}={}".format(k, v) | ngx_esc }}
{%- endfor %}
;
{%- endif %}
{% endmacro %}