using 'logging' for logging

3 views
Skip to first unread message

Ville M. Vainio

unread,
Apr 19, 2011, 6:17:43 AM4/19/11
to leo-editor
Idle thought:

Python has an official 'logging' module. I've used it a bit, and it
really wasn't as bad an I remembered it to be ;-). It is more on the
side of "powerful" than "simple", though.

Perhaps we should investigate using it for logging inside leo as well.
Plugins could specify their log domains etc. It would also be possible
to redirect logs to leo log windows, or wherever.

Kent Tenney

unread,
Apr 19, 2011, 9:10:58 AM4/19/11
to leo-e...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "leo-editor" group.
> To post to this group, send email to leo-e...@googlegroups.com.
> To unsubscribe from this group, send email to leo-editor+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.

Great idea. A lot of work has gone into logging, including, I believe,
simplification.

tools extending logging:
http://plumberjack.blogspot.com/p/handlers-for-logging.html

I would love it if a logger was available to <ctl b> and buttons.

Logging seems related to testing in a "best practices" sort of way.

Thanks,
Kent


>
>

Ville M. Vainio

unread,
Apr 19, 2011, 9:27:24 AM4/19/11
to leo-e...@googlegroups.com
On Tue, Apr 19, 2011 at 4:10 PM, Kent Tenney <kte...@gmail.com> wrote:

Ok, we should probably adapt this to Qt, in order to support logging
to leo panes:

http://stackoverflow.com/questions/2819791/redirect-logging-output-using-custom-logging-handler/2821097#2821097

Edward K. Ream

unread,
Apr 19, 2011, 9:41:49 AM4/19/11
to leo-e...@googlegroups.com
On Tue, Apr 19, 2011 at 8:10 AM, Kent Tenney <kte...@gmail.com> wrote:

>> Python has an official 'logging' module. I've used it a bit, and it
>> really wasn't as bad an I remembered it to be ;-). It is more on the
>> side of "powerful" than "simple", though.

Leo has a good logger. It's called g.trace. The most important
contribution you can make, Ville, to Python 3.x compatibility is to
use g.trace instead of print :-)

I myself have zero interest in Python's logging module, but it would
be easy enough to add more features to g.trace: log to log pane, log
to file, log to logging.Logger objects, etc.

At the code level it would be easy to extend g.trace because it's
signature is already g.trace(*args,**keys).

Edward

Reply all
Reply to author
Forward
0 new messages