Re: [PATCH v13 06/14] apply: make it possible to silently apply
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Sep 1, 2016, 08:01 UTC
- Message-ID
- <CAP8UFD3RE6L17nQmvZTkx6wycsdG7EA9eM=tYQD8nrS445zg1w@mail.gmail.com>
- In-Reply-To
- <CAGZ79kYnp_8iew33KQJK1TB0ROLthHBtvHqf3wVzFkh_JSq5MA@mail.gmail.com>
On Thu, Sep 1, 2016 at 12:07 AM, Stefan Beller <sbeller@google.com> wrote:
Show 10 quoted lines
>> Printing on stdout, and calls to warning() or error() are not
>> taken care of in this patch, as that will be done in following
>> patches.
>
>> - if (state->apply_verbosely)
>> + if (state->apply_verbosity > verbosity_normal)
>> error(_("while searching for:\n%.*s"),
>> (int)(old - oldlines), oldlines);
>
> But this is an error(..) ?Do you mean that it was a bug in the original code to print this error only in verbose mode?
Show 7 quoted lines
> Have you considered to replace all these print functions (error, warning, > fprintf, printf, fprintf_ln) with another custom > > int say_when_at_least(verbosity level, const char *fmt,...) > > ? (I guess that would be more invasive, but the result would be more > consistent.)
My opinion is that there is a reason (or there should have been a reason) why people decided to use error() instead of warning() for example. If I use say_when_at_least(verbosity level, const char *fmt,...) like you suggest, how do I decide if error() or warning() is used to actually print the error message? Another parameter to this function (severity level?) is needed.
Anyway I don't think such a refactoring is needed.