[merge] accept LogFormatter instances in cmd_log.run
Adeodato Simó
dato at net.com.org.es
Fri Jul 28 15:08:23 BST 2006
* Aaron Bentley [Fri, 28 Jul 2006 09:40:32 -0400]:
> Adeodato Simó wrote:
> > Another one that strikes me as sensible is having cmd_log.run accept a
> > LogFormatter instance in the log_format argument. The rationale is the
> > following: one can, of course, create a CustomLogFormatter class,
> > register it, and call log with log_format='custom_format'. However, this
> > is of little use when one wants the class to collect data, since there
> > is no way to retrieve the created CustomLogFormatter instance back from
> > cmd_log.run().
> In general, you shouldn't be calling cmd_log.run.
Hm. "I", as in "a plugin", shouldn't be calling cmd_log.run ?
> The purpose of that function is to decode commandline parameters and
> invoke the underlying functionality, i.e. show_log. (Which *does*
> accept a log formatter, of course.)
Yes, but that decoding has a lot of logic that a wrapper plugin may not
want to duplicate. I know wrappeability is crucial for me (*), and I can't
see that providing it for those who _want_ to use it is a bad thing?
(*) Either because is the easiest way to code a plugin, or because I'm
unable to find another more elgant or proper way to do it. Consider
for example cmd_logdiff.py [1], which is what prompted me to propose
this change.
Cheers,
References:
[1] http://people.debian.org/~adeodato/code/bzr/plugins/private/adeodato/cmd_logdiff.py
--
Adeodato Simó dato at net.com.org.es
Debian Developer adeodato at debian.org
Listening to: Hooverphonic - You Love Me To Death
More information about the bazaar
mailing list