logger
index
/home/dlink/vlib/vlib/logger.py

 
Modules
       
conf
logging
os
smtplib
socket

 
Classes
       
logging.Formatter(__builtin__.object)
CustomFormatter
logging.handlers.SMTPHandler(logging.Handler)
TlsSMTPHandler

 
class CustomFormatter(logging.Formatter)
    Custom Log Formatter
Taken from Gloria's code in Bookserver
 
 
Method resolution order:
CustomFormatter
logging.Formatter
__builtin__.object

Methods defined here:
format(self, record)

Methods inherited from logging.Formatter:
__init__(self, fmt=None, datefmt=None)
Initialize the formatter with specified format strings.
 
Initialize the formatter either with the specified format string, or a
default as described above. Allow for specialized date formatting with
the optional datefmt argument (if omitted, you get the ISO8601 format).
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.
usesTime(self)
Check if the format uses the creation time of the record.

Data descriptors inherited from logging.Formatter:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

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 TlsSMTPHandler(logging.handlers.SMTPHandler)
    
Method resolution order:
TlsSMTPHandler
logging.handlers.SMTPHandler
logging.Handler
logging.Filterer
__builtin__.object

Methods defined here:
emit(self, record)
Override SMTPHandler, in order to use gmail

Methods inherited from logging.handlers.SMTPHandler:
__init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None)
Initialize the handler.
 
Initialize the instance with the from and to addresses and subject
line of the email. To specify a non-standard SMTP port, use the
(host, port) tuple format for the mailhost argument. To specify
authentication credentials, supply a (username, password) tuple
for the credentials argument. To specify the use of a secure
protocol (TLS), pass in a tuple for the secure argument. This will
only be used when authentication credentials are supplied. The tuple
will be either an empty tuple, or a single-value tuple with the name
of a keyfile, or a 2-value tuple with the names of the keyfile and
certificate file. (This tuple is passed to the `starttls` method).
getSubject(self, record)
Determine the subject for the email.
 
If you want to specify a subject line which is record-dependent,
override this method.

Methods inherited from logging.Handler:
acquire(self)
Acquire the I/O thread lock.
close(self)
Tidy up any resources used by the handler.
 
This version removes the handler from an internal map of handlers,
_handlers, which is used for handler lookup by name. Subclasses
should ensure that this gets called from overridden close()
methods.
createLock(self)
Acquire a thread lock for serializing access to the underlying I/O.
flush(self)
Ensure all logging output has been flushed.
 
This version does nothing and is intended to be implemented by
subclasses.
format(self, record)
Format the specified record.
 
If a formatter is set, use it. Otherwise, use the default formatter
for the module.
get_name(self)
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.
set_name(self, name)

Data descriptors inherited from logging.Handler:
name

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.

Data descriptors inherited from logging.Filterer:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
getLogger(name)
A Factory mentod.
Returns: An instance of Python Logger
test()

 
Data
        HOSTNAME = 'antares'