__init__(self,
writer,
filters=None,
observers=None,
cfnMode=1,
tsFormat=None,
initMsg=False,
jobhistSize=100,
oie=True)
(Constructor)
| source code
|
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
- Parameters:
cfnMode - One of the MODE...constants. CFN_SHORT: Caller File Names
minimal,i.e.file name without directory path(=Default) CFN_FULL:
Caller File Names with full file path) Default is CFN_SHORT
tsFormat - strftime-format string with an extension: use %3N for
milliseconds. [Year..second are: %Y/%y,%m,%d,%H,%M,%S] None for
no timestamps. For convenience: The String "std1" is
interpreted as "%H:%M.%S;%3N". The String
"std2" is interpreted as "%m/%d %H:%M.%S".
observers - list of callables, called with args: jobhist, writer. Called each
time after(!) a message was written. writer is the specific
writer (depends on DB/file/Stdout modus.) jobhist are the N last
message-jobs, with the latests at [-1]. The size N of the jobhist
is limited by jobhistSize. Increase jobhistSize if your observer
needs to see a large job history. The observers are processed in
the given order. You can modify job content for following
observers, without affecting the log (since the observers are
called after the line is written.) For compatibility: An observer
can also have an observe() method. If available, this is used
(instead of __call__)
filters - list of callable objects, analogous to observers. But filters are
called before logging. When they modify the message, the change
gets visible in the log.
initMsg - if True, write a short and witless initial message to test the
LogWriter
jobhistSize - The count of recent messages that are available as a list (these
may be read by observers). Default=100
oie - Observe Internal Error; defines how to handle errors occurring in
the observers and filters. If True, in case of an internal error
in an observer/filter, all observers/filters receive an
additional message describing the error. If False, the
observers/filters are not notified about the internal error (but
the internal error still appears in the main log.)
- Raises:
AssertionError - if an observer is >1 times in the list
AssertionError - if a filter is >1 times in the list
- Overrides:
object.__init__
Attention:
The logged time stamps can be significantly later than the log()
call of your application, because time is taken by the LogServer
which may be remote connected.
|