Re: [PATCH 3/7] trace: use warning() for printing trace errors
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 4, 2016, 20:41 UTC
- Message-ID
- <xmqqk2fw1d41.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160803225826.hlr273h4cy2hcfyk@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 17 quoted lines
> Right now we just fprintf() straight to stderr, which can > make the output hard to distinguish. It would be helpful to > give it one of our usual prefixes like "error:", "warning:", > etc. > > It doesn't make sense to use error() here, as the trace code > is "optional" debugging code. If something goes wrong, we > should warn the user, but saying "error" implies the actual > git operation had a problem. So warning() is the only sane > choice. > > Note that this does end up calling warn_routine() to do the > formatting. So in theory, somebody who tries to trace from > their warn_routine() could cause a loop. But nobody does > this, and in fact nobody in the history of git has ever > replaced the default warn_builtin (there isn't even a > set_warn_routine function!).
I think the last bit is about to change; cf. 545f13c0 (usage: add set_warn_routine(), 2016-07-30) on cc/apply-am topic.