all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Bruno Victal <mirai@makinata.eu>
Cc: 62490@debbugs.gnu.org, mail@cbaines.net, maxim.cournoyer@gmail.com
Subject: [bug#62490] [PATCH] services: nginx: Make logging level configurable.
Date: Sun, 02 Apr 2023 17:39:41 +0200	[thread overview]
Message-ID: <87jzyuths2.fsf@gnu.org> (raw)
In-Reply-To: <fa44bc8a46021c3d307479ea2fbdf04d68e0cd10.1679942599.git.mirai@makinata.eu> (Bruno Victal's message of "Mon, 27 Mar 2023 19:51:04 +0100")

Hi,

Bruno Victal <mirai@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:

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

Ludo’.




  parent reply	other threads:[~2023-04-02 15:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 18:51 [bug#62490] [PATCH] services: nginx: Make logging level configurable Bruno Victal
2023-03-28 14:12 ` Maxim Cournoyer
2023-03-28 14:32   ` Bruno Victal
2023-03-28 15:03     ` Maxim Cournoyer
2023-04-02 15:39 ` Ludovic Courtès [this message]
2023-04-11 17:12   ` bug#62490: " Maxim Cournoyer
2023-04-03 11:58 ` [bug#62490] [PATCH v2 1/2] " Bruno Victal
2023-04-03 11:58   ` [bug#62490] [PATCH v2 2/2] services: nginx: Add reopen action Bruno Victal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzyuths2.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=62490@debbugs.gnu.org \
    --cc=mail@cbaines.net \
    --cc=maxim.cournoyer@gmail.com \
    --cc=mirai@makinata.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.