unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 62490-done@debbugs.gnu.org, Bruno Victal <mirai@makinata.eu>,
	mail@cbaines.net
Subject: bug#62490: [PATCH] services: nginx: Make logging level configurable.
Date: Tue, 11 Apr 2023 13:12:16 -0400	[thread overview]
Message-ID: <87bkjumjgv.fsf_-_@gmail.com> (raw)
In-Reply-To: <87jzyuths2.fsf@gnu.org> ("Ludovic Courtès"'s message of "Sun, 02 Apr 2023 17:39:41 +0200")

Hi,

Ludovic Courtès <ludo@gnu.org> writes:

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




  reply	other threads:[~2023-04-11 17:13 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
2023-04-11 17:12   ` Maxim Cournoyer [this message]
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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87bkjumjgv.fsf_-_@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=62490-done@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=mail@cbaines.net \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).