On Wed, 7 Mar 2018 15:00:42 -0800 (PST)
"Edward K. Ream" <edream...@gmail.com> wrote:

> On Wednesday, March 7, 2018 at 2:19:03 PM UTC-6, Terry Brown wrote:
> Looks like support for log_error_color, log_warning_color, and 
> > log_text_foreground_color was dropped here: 
> >
> >
> > https://github.com/leo-editor/leo-editor/commit/de0dcfa6c61#diff-e21cdd51aaf19b4a9e614b5f2ee9e97aL6129
> >   
> Ah. Here we come to the crux.  It would be possible to add those
> hacks back in, but the new way is actually clearer and more flexible:
>    g.es(s, color='red') uses @color log_red_color

I really don't understand the disconnect here.  I want to log a warning
to the log pane.  Ideally, it would be

    g.log("Warning, keep away from children", type="warning")
    g.warning("Warning, keep away from children")

(I prefer the former)

Instead, for historical reasons, we have

    g.es("Warning, keep away from children", color="warning")

at least until recently, but now apparently we're supposed to use

    g.es("Warning, keep away from children", color="blue")

So we (a) need to know that 'blue' is the arbitrary color code for
warnings, and (b) that this will print a message in the log in a theme
defined color that may not be any kind of blue.

So we're going backwards.

So (so so so) if I do the work, would you accept changes that:

 - make g.log an alias for g.es, breaking all code / scripts that rely
   on g.log writing to ~/test/leo_log.txt, except for calls in the Leo
   code base which I'll fix and calls that use fn, which I'll still
   support.  Bearing in mind that g.log doesn't create the required
   directory I suspect it's not really used at all.

 - adds a `type` kwarg to g.es which renders messages in
   log_`type`_color if it's defined else sensible defaults for
   info/warning/error/debug/critical/exception (the Python logging

 - replaces calls to g.es with g.log throughout the code base.

 - replaces color='red' with type='error' etc. throughout the code base.

I think Leo would be best served by making all of these changes, but
I'm also prepared to make some subset of these changes if there are
some that you just can't bring yourself to bear.  Also if you don't
want the visual miscue of syntax highlighting on `type` we could call
it `role`, although I prefer type.

Cheers -Terry

>    g.es(s, color='warning') uses @color log_warning_color
>    g.es(s, color='text_foreground') uses @color
> log_text_foreground_color g.es(s, color='tnb') uses @color
> log_tnb_color
> Naturally, a default is used when a setting doesn't exist.
> So the reason that the new scheme "ignores" a setting is that there
> is no call to that "color".  But that's not my problem ;-)
> Edward

You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to