ade.util.Messenger(object)
class documentation
Part of ade.util
(View In Hierarchy)
My module-level msg
instance writes messages to STDOUT or
another writable object in an extremely flexible manner.
My public API is mostly in __call__
, although
writeLine
, writeChar
, and lineWritten
are
public and can be useful on their own.
Method | __init__ | Undocumented |
Method | __bool__ | Undocumented |
Method | writeLine | Writes the supplied line of text to my current writable object fh, with a trailing newline. |
Method | writeChar | Writes the single character x to my current ratable object fh, with no newline. |
Method | lineWritten | Returns True if a line was written since the last time this
was called. |
Method | __call__ | A very convenient and flexible messaging method. Call at the module
level with msg . |
Method | _dashes | Undocumented |
Method | _fhSet | Undocumented |
Writes the supplied line of text to my current writable object fh, with a trailing newline.
If there's been a call to writeChar
since
the last time this method was called, a newline is written before
line.
If fh is currently None
, nothing is written.
Writes the single character x to my current ratable object fh, with no newline.
Sets my newlineNeeded flag to indicate that a newline is needed
before the next line of text gets written via writeLine
.
If fh is currently None
, nothing is written.
Returns True
if a line was written since the last time this
was called.
The module-level call to make is msg.lineWritten()
.
A very convenient and flexible messaging method. Call at the module
level with msg
.
The module-level call to make is msg(...)
.
Call with True
as the first or only argument to log to
STDOUT, or with an open file handle to log to that. Call with
False
or None
as the first or only argument to
stop logging. With a single argument, returns the previous file handle.
Call it with a string formatting prototype and the appropriate number of formatting arguments to log a line of text. (Of course, you can just supply the text with no formatting codes instead.)
You can precede the text or text proto/args with 0
or
-1
to insert a blank line before the text. Similarly, you can
follow it with 0
or -1
to append a blank line
after the text.
You can precede or follow the with a single hyphen character ("-") to precede or follow the text with a row of hyphens as a separator. (You can also combine this with a numerical argument that comes immediately before or after.)
Call with no arguments just to get the present file handle. That will always be returned unless a single argument was supplied, in which case the previous file handle is what gets returned.