[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Ludovic Courtès
Subject: [bug#62490] [PATCH] services: nginx: Make logging level configurable.
Date: Sun, 02 Apr 2023 17:39:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)


Bruno Victal <> 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

  (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:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,optimize (unless (memq 'debug '(debug info)) (throw 'x))
$13 = (if #f #f)
--8<---------------cut here---------------end--------------->8---


reply via email to

[Prev in Thread] Current Thread [Next in Thread]