GNU bug report logs -
#62490
[PATCH] services: nginx: Make logging level configurable.
Previous Next
Reported by: Bruno Victal <mirai <at> makinata.eu>
Date: Mon, 27 Mar 2023 18:52:02 UTC
Severity: normal
Tags: patch
Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #28 received at 62490-done <at> debbugs.gnu.org (full text, mbox):
Hi,
Ludovic Courtès <ludo <at> gnu.org> writes:
> Hi,
>
> Bruno Victal <mirai <at> makinata.eu> 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
This bug report was last modified 2 years and 36 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.