| |
- logging.Formatter
-
- ACSFormatter
- logging.LogRecord
-
- ACSLogRecord
- logging.handlers.BufferingHandler(logging.Handler)
-
- ACSHandler
class ACSFormatter(logging.Formatter) |
|
This trivial helper class is used to automate setting up the way logs are
printed. |
|
Methods defined here:
- __init__(self)
- Constructor.
- format(self, record)
- Overload.
Methods inherited from logging.Formatter:
- formatException(self, ei)
- Format and return the specified exception information as a string.
This default implementation just uses
traceback.print_exception()
- formatTime(self, record, datefmt=None)
- Return the creation time of the specified LogRecord as formatted text.
This method should be called from format() by a formatter which
wants to make use of a formatted time. This method can be overridden
in formatters to provide for any specific requirement, but the
basic behaviour is as follows: if datefmt (a string) is specified,
it is used with time.strftime() to format the creation time of the
record. Otherwise, the ISO8601 format is used. The resulting
string is returned. This function uses a user-configurable function
to convert the creation time to a tuple. By default, time.localtime()
is used; to change this for a particular formatter instance, set the
'converter' attribute to a function with the same signature as
time.localtime() or time.gmtime(). To change it for all formatters,
for example if you want all logging times to be shown in GMT,
set the 'converter' attribute in the Formatter class.
Data and other attributes inherited from logging.Formatter:
- converter = <built-in function localtime>
- localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,tm_sec,tm_wday,tm_yday,tm_isdst)
Convert seconds since the Epoch to a time tuple expressing local time.
When 'seconds' is not passed in, convert the current time instead.
|
class ACSHandler(logging.handlers.BufferingHandler) |
|
Class ACSHandler is a BufferingHandler subclass which sends log messages to
the (CORBA) ACS Log Svc. If the CORBA logging service is unavailable the log
message will be saved and the handler will try to publish the log next time
provided the buffer has not reached full capacity. If the buffer is full and
the logging service is still unavailable, the buffer is reset and the log
messages are lost from this handlers perspective. |
|
- Method resolution order:
- ACSHandler
- logging.handlers.BufferingHandler
- logging.Handler
- logging.Filterer
Methods defined here:
- __init__(self, capacity=1000, dispatchlevel=51, batchsize=10)
- Constructor.
Parameters:
capacity - the maximum size of the log cache.
dispatchlevel - level of message that should be immediately sent
batchsize - the number of log records to be held before sending
flushinterval - maximum period that a message can wait in the send queue
- emit(self, record)
- Overridden.
Append the record. If shouldFlush() tells us to, call flush() to process
the buffer.
- flush(self)
- Overridden
- flushToFile(self, record)
- Helper method.
Sends a single record to file.
Parameters:
- record a Logging record
Returns: Nothing
Raises: ???
- getCORBALogger(self)
- If the CORBA logging service is up and running, returns a reference to
it. Otherwise, returns None.
- initFileHandler(self)
- Helper method initializes the file handler
- sendLog(self, record)
- Method which sends logs to the real ACS logging service.
- shouldFlush(self, record)
- Overridden.
This method returns true if the number of pending records exceeds
the batchsize or if the new record matches or exceeds the immediate
dispatch priority.
Methods inherited from logging.handlers.BufferingHandler:
- close(self)
- Close the handler.
This version just flushes and chains to the parent class' close().
Methods inherited from logging.Handler:
- acquire(self)
- Acquire the I/O thread lock.
- createLock(self)
- Acquire a thread lock for serializing access to the underlying I/O.
- format(self, record)
- Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter
for the module.
- handle(self, record)
- Conditionally emit the specified logging record.
Emission depends on filters which may have been added to the handler.
Wrap the actual emission of the record with acquisition/release of
the I/O thread lock. Returns whether the filter passed the record for
emission.
- handleError(self, record)
- Handle errors which occur during an emit() call.
This method should be called from handlers when an exception is
encountered during an emit() call. If raiseExceptions is false,
exceptions get silently ignored. This is what is mostly wanted
for a logging system - most users will not care about errors in
the logging system, they are more interested in application errors.
You could, however, replace this with a custom handler if you wish.
The record which was being processed is passed in to this method.
- release(self)
- Release the I/O thread lock.
- setFormatter(self, fmt)
- Set the formatter for this handler.
- setLevel(self, level)
- Set the logging level of this handler.
Methods inherited from logging.Filterer:
- addFilter(self, filter)
- Add the specified filter to this handler.
- filter(self, record)
- Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto
this and the record is then dropped. Returns a zero value if a record
is to be dropped, else non-zero.
- removeFilter(self, filter)
- Remove the specified filter from this handler.
|
|