Subject: Re: bug#62490: [PATCH] services: nginx: Make logging level configurable.

From: Maxim Cournoyer <[email-masked]>
Date: Tue, 11 Apr 2023 13:12:16 -0400

Hi,

Ludovic Courtès <[email-masked]> writes:

> Hi,
>
> Bruno Victal <[email-masked]> skribis:
>
>> +(define-compile-time-procedure (assert-valid-log-level (level symbol?))
>> +  "Ensure @var{level} is one of @code{'debug}, @code{'info}, @code{'notice},
>> +@code{'warn}, @code{'error}, @code{'crit}, @code{'alert}, or @code{'emerg}."
>
> As it turns out, ‘define-compile-time-procedure’ cannot work with
> symbols.  In short, that’s because in the end the generated macro
> checks:
>
>   (symbol? #'(quote debug))
>
> which doesn’t do what we want.
>
> Anyway, you can either make it a regular procedure instead, or use a
> trick found in R6RS and used in some places in Guix, Guile-Gcrypt, etc.,
> which is to define a macro that validates things:
>
>   (endianness little)  ;R6RS
>
>   (operating-id valid-path?) ;(guix store), with ‘define-enumerate-type’
>
> Making it a procedure is prolly good enough.  The compiler can optimize
> it out at compile time, FWIW:
>
> scheme@(guile-user)> ,optimize (unless (memq 'debug '(debug info)) (throw 'x))
> $13 = (if #f #f)

I've installed Bruno's v2, which reworked the above into a simple
procedure.

Closing!

-- 
Thanks,
Maxim