The following Leo script demonstrates what is wanted.  Run from any node to 
create a listener:

'''
A socket listener, listening on localhost. See:
https://docs.python.org/2/howto/logging-cookbook.html#sending-and-receiving-logging-events-across-a-network

Start this listener first, then start the broadcaster.
curses_gui_broadcast.py is a prototype.
cursesGui2.py is the "real" broadcaster.
'''
g.cls()
import subprocess
import sys
command = r'%s %s' % (
    sys.executable,
    g.os_path_finalize_join(g.app.loadDir,
        '..', 'plugins', 'curses_gui_listen.py'))
print('Starting curses_gui_listen.py')
proc = subprocess.Popen(
    command,
    shell=False,
    universal_newlines=True,
)

Then from another console, run python3 leo\plugins\curses_gui_broadcast.py. 
This just produces logging output, which shows up in Leo's console!  It's 
unchanged from example in the logging cookbook 
<https://docs.python.org/3/howto/logging-cookbook.html#sending-and-receiving-logging-events-across-a-network>,
 
except for imports.

The listener script will become the basis for a 'listen-for-logging' 
command.  But first, I'll modify cursesGui2.py so it broadcasts to the 
listener.  In particular, g.trace will result in a log message.  I've never 
used Python logging module, but clearly it's flexible enough to do whatever 
we want.

This is a cool new direction for Leo.

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 [email protected].
To post to this group, send email to [email protected].
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