Package skytools :: Module skylog :: Class LogDBHandler
[frames] | no frames]

Class LogDBHandler

source code

      logging.Filterer --+        
                         |        
           logging.Handler --+    
                             |    
logging.handlers.SocketHandler --+
                                 |
                                LogDBHandler

Sends log records into PostgreSQL server.

Additionally, does some statistics aggregating, to avoid overloading log server.

It subclasses SocketHandler to get throtthling for failed connections.

Instance Methods
 
__init__(self, connect_string)
Initializes the handler with a specific connection string.
source code
 
createSocket(self) source code
 
makeSocket(self)
Create server connection.
source code
 
emit(self, record)
Process log record.
source code
 
process_rec(self, record)
Aggregate stats if needed, and send to logdb.
source code
 
aggregate_stats(self, msg)
Sum stats together, to lessen load on logdb.
source code
 
flush_stats(self, service)
Send awuired stats to logdb.
source code
 
send_to_logdb(self, service, type, msg)
Actual sending is done here.
source code

Inherited from logging.handlers.SocketHandler: close, handleError, makePickle, send

Inherited from logging.Handler: acquire, createLock, flush, format, handle, release, setFormatter, setLevel

Inherited from logging.Filterer: addFilter, filter, removeFilter

Method Details

__init__(self, connect_string)
(Constructor)

source code 
Initializes the handler with a specific connection string.
Overrides: logging.handlers.SocketHandler.__init__

makeSocket(self)

source code 
Create server connection. In this case its not socket but psycopg conection.
Overrides: logging.handlers.SocketHandler.makeSocket

emit(self, record)

source code 
Process log record.
Overrides: logging.handlers.SocketHandler.emit