[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: -v, --verbosity=LEVEL use the given verbosity LEVEL
From: |
Simon Tournier |
Subject: |
Re: -v, --verbosity=LEVEL use the given verbosity LEVEL |
Date: |
Wed, 11 Oct 2023 17:36:00 +0200 |
Hi,
On Wed, 11 Oct 2023 at 11:11, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>> To answer a question elsewhere in this threads, I think these levels
>> come from Nix and daemon side.
>>
>>> See info '(guix) Invoking guix build':
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> ‘-v LEVEL’
>>> ‘--verbosity=LEVEL’
>>> Use the given verbosity LEVEL, an integer. Choosing 0 means that
>>> no output is produced, 1 is for quiet output; 2 is similar to 1 but
>>> it additionally displays download URLs; 3 shows all the build log
>>> output on standard error.
>>> --8<---------------cut here---------------end--------------->8---
>>
>> Maybe, we could add an option as ’--list-verbosity’ which would display
>> that information.
>>
>> Well, the main issue, IMHO, is that the option ’--verbosity’ is not
>> shared across various command-line scripts, but implemented script per
>> script, IIRC.
>
> Oh, is it? That's not great.
Well, maybe the first step would to refactor and move to
%standard-build-options. Or something like that.
guix/scripts/build.scm reads:
--8<---------------cut here---------------start------------->8---
(define (show-help)
(display (G_ "Usage: guix build [OPTION]... PACKAGE-OR-DERIVATION...
Build the given PACKAGE-OR-DERIVATION and return their output paths.\n"))
[...]
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(define %options
;; Specifications of the command-line options.
[...]
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result)
(let ((level (string->number* arg)))
(alist-cons 'verbosity level
(alist-delete 'verbosity result)))))
--8<---------------cut here---------------end--------------->8---
And guix/scripts/package.scm reads:
--8<---------------cut here---------------start------------->8---
(define (show-help)
(display (G_ "Usage: guix package [OPTION]...
Install, remove, or upgrade packages in a single transaction.\n"))
[...]
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(newline)
(define %options
;; Specification of the command-line options.
[...]
(option '(#\v "verbosity") #t #f
(lambda (opt name arg result arg-handler)
(let ((level (string->number* arg)))
(values (alist-cons 'verbosity level
(alist-delete 'verbosity result))
#f))))
--8<---------------cut here---------------end--------------->8---
For some instances. :-)
> Oh, is it? That's not great. I've never used it, but Guix already
> soft-depends on guile-lib, and guile-lib provides a logging library.
> Perhaps if we used that we would benefit from some standardized and
> global way to perform logging across at least the host-side code? And
> that'd help more straightforwardly reason and explain the levels?
Well, I think the ’verbosity’ is something passed to some C++
guix-daemon side and not used on Guile side.
Cheers,
simon