verbose

I added a Verbose class to matplotlib.__init__ and some verbose
options to rc. Quoting from rc

    # Set the verbose flags. This controls how much information
    # matplotlib gives you at runtime and where it goes. Ther verbosity
    # levels are: silent, error, helpful, debug, debug-annoying. At the
    # error level, you will only get error messages. Any level is
    # inclusive of all the levels below it. Ie, if your setting is
    # helpful, you'll also get all the error messages. If you setting is
    # debug, you'll get all the error and helpful messages. It is not
    # recommended to make your setting silent because you will not even
    # get error messages. When submitting problems to the mailing-list,
    # please set verbose to helpful or debug and paste the output into
    # your report.

···

#
    #
    # The fileo gives the destination for any calls to verbose.report.
    # The erro gives the destination for any calls to
    # verbose.report_error. These objects can a filename, sys.stderr, or
    # sys.stdout.
    #
    # You can access the verbose instance in your code
    # from matplotlib import verbose.
    verbose.level : helpful # one of silent, error, helpful, debug, debug-annoying
    verbose.fileo : sys.stdout # a log filename, sys.stdout or sys.stderr
    verbose.erro : sys.stderr # a log filename, sys.stdout or sys.stderr

In matplotlib code, you should no longer print to stdout or stderr;
rather you should do

    verbose.report('some message')
    verbose.report_error('some error message')

    #only report at debug levels or higher
    verbose.report('some message', 'debug')

I haven't migrated all the matplotlib code yet, but I've gotten a
start. I've made some changes to the code base already so that
typical causes of user problems are reported in the helpful mode. Eg,

    hunter:~/python/projects/matplotlib> python examples/simple_plot.py -dWXAgg
    loaded rc file /hunter/jdhunter/python/projects/matplotlib/.matplotlibrc
    verbose.level helpful
    interactive False
    matplotlib version 0.63.4
    numerix Numeric 23.5
    font search path ['/usr/local/share/matplotlib']
    loaded ttfcache file /home/jdhunter/.ttffont.cache
    matplotlib data path /usr/local/share/matplotlib
    backend WXAgg version 2.4.2.4u

Backend authors, please set the string backend_version. The default
is 'unknown'. Eg in wx

    backend_version = wx.VERSION_STRING

Are the levels indicated above sufficient to cover the spectrum?

What should the default be (either error or helpful)?

Should we add a command line flag to allow the user to override the
default level for easy access to debug info?

Let me know if you have any comments or problems with the design or
implementation.

JDH

John Hunter schrieb:

Are the levels indicated above sufficient to cover the spectrum?

They sound reasonable, though I'd almost prefer a numerical value (0-4) instead of the names. Minor nit, though, feel free to ignore.

What should the default be (either error or helpful)?

Error. Good command line tools stay silent when successful (I'm paraphrasing some well-known unix quote I don't have at hand)

Should we add a command line flag to allow the user to override the
default level for easy access to debug info?

Yes.

Good job.

f