To work on plugin engine I need to have logging system for Spyder in place,
so that problems with plugins and discovery could be introspected and
analysed more easily.
I don't want to use logging module, because I don't like that it is not
silent
by default, makes implicit autoconfiguration on first log call, has
heavyweight
setup feels too heavy with all these logging levels and Java-style
hierarchy.
What I need is a simple FIFO queue of fixed length with single .put()
method.
The queue is shared across all Spyder threads and can be replaced with
more advanced processing interface if needed as long as it supports .put()
method. Message format is just a simple string. I intend to use string
prefixes for filtering like:
"plugins: discovered xxx.py version 1.2 in ..."
Why Queue?
1. open GUI window at any time to dump collected messages
2. global space with diagnostics on Spyder internals
3. postmortem dump of messages
4. easy access to forward and process messages if needed a quick hack
How it will work?
If application uses spyderlib imports, it will do:
from spyderlib import spylog
spylog.put(message)
If it doesn't use spyderlib imports, it creates queue itself if it doesn't
exist:
# init spyderlog
import queue
if 'spylog' not in queue.__dict__:
queue.spylog = queue.Queue(2000) # 2000 messages should be enough
spylog = queue.spylog
There is one more thing to it. Not all messages may be strings, because
sometimes you need to gather a lot of objects across different threads. I
wonder if it is possible, or I am missing something in this idea.
--
You received this message because you are subscribed to the Google Groups
"spyder" 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 http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.