Package rrlog :: Package server :: Module dbwriter_sa
[hide private]
[frames] | no frames]

Module dbwriter_sa

source code


Author: Ruben Reifenberg

Classes [hide private]
  _Coltypes
Column types
  DBConfig
  DBLogWriter
USes SQLAlchemy (sa), Assigned to 1 Table
  LOGWRITER_CLASS
USes SQLAlchemy (sa), Assigned to 1 Table
Functions [hide private]
 
createRotatingServer(engineStr, rotateCount, rotateLineMin, tableNamePattern='log_%s', tsFormat=None, filters=None, observers=None, logwriterFactory=None, drop=True, cols=None, format_dict=None) source code
 
createLocalLog(engineStr, rotateCount, rotateLineMin, traceOffset=0, tableNamePattern='log_%s', filters=None, observers=None, tsFormat='std1', stackMax=5, drop=True, catsEnable=None, catsDisable=None, seFilesExclude=None, name=None, cols=None, extractStack=True)
Returns: callable log object, ready to use
source code
 
default_format_dict(job)
Format the row fields for writing.
source code
Variables [hide private]
  MYSQL_ENGINE = 'MyISAM'
Function Details [hide private]

createRotatingServer(engineStr, rotateCount, rotateLineMin, tableNamePattern='log_%s', tsFormat=None, filters=None, observers=None, logwriterFactory=None, drop=True, cols=None, format_dict=None)

source code 
Parameters:
  • engineStr - SQLAlchemy engine str
  • tableNamePattern - table name incl.placeholder for int (rotate number), e.g. "mylog%d"
  • filters - default = () See rrlog.server.LogServer.__init__
  • observers - default = () See rrlog.server.LogServer.__init__
  • tsFormat - timestamp format. See rrlog.server.LogServer.__init__
  • rotateCount - int >=1, how many tables to use for rotation
  • rotateLineMin - rotate when ~ lines are written. None to switch off rotation.
  • logwriterFactory - Creates LogWriter instances (one per db table). If None, the module variable LOGWRITER_CLASS is used.
  • drop - if True, drop an eventually existing table. When False, append to an existing one (this is possible with rotateCount==1 only).
  • cols - Custom column configuration. See rrlog.server.dbwriter_sa.DBConfig.__init__
  • format_dict - callable taking a job and returning {colname:fieldcontent}. Ignored if a logwriterFactory is given.
Raises:
  • AssertionError - when drop==False and rotateCount > 1

createLocalLog(engineStr, rotateCount, rotateLineMin, traceOffset=0, tableNamePattern='log_%s', filters=None, observers=None, tsFormat='std1', stackMax=5, drop=True, catsEnable=None, catsDisable=None, seFilesExclude=None, name=None, cols=None, extractStack=True)

source code 
Parameters:
Returns:
callable log object, ready to use

default_format_dict(job)

source code 

Format the row fields for writing.

Returns:
{colname:fieldcontent} as to be written into the database row.