HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
app.Utils.MPLogger Class Reference
Inheritance diagram for app.Utils.MPLogger:
Collaboration diagram for app.Utils.MPLogger:

Public Member Functions

def __init__ (self)
 
def getLogger (self, loggerName=None, fileNameSuffix='', restore=False)
 

Public Attributes

 fnameOld
 

Static Public Attributes

string ROTATED_ATTRIBUTE_NAME = '__rotated'
 

Detailed Description

Definition at line 1326 of file Utils.py.

Constructor & Destructor Documentation

◆ __init__()

def app.Utils.MPLogger.__init__ (   self)

Definition at line 1332 of file Utils.py.

1332  def __init__(self):
1333  super(MPLogger, self).__init__()
1334  self.fnameOld = ''
1335 
1336 
1337 # #rotation log files of logger
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ getLogger()

def app.Utils.MPLogger.getLogger (   self,
  loggerName = None,
  fileNameSuffix = '',
  restore = False 
)

Definition at line 1341 of file Utils.py.

1341  def getLogger(self, loggerName=None, fileNameSuffix='', restore=False):
1342  if loggerName is None:
1343  ln = APP_CONSTS.LOGGER_NAME
1344  else:
1345  ln = loggerName
1346 
1347  if fileNameSuffix != '' or restore is True:
1348  rollover = False
1349  else:
1350  rollover = True
1351 
1352  try:
1353  # Get regular logger
1354  lg = logging.getLogger(ln)
1355  # Replace logger name for processes instances
1356  lfn = LoggerFileName(lg)
1357  fname = lfn.findReplace()
1358  if fname is not None and fname != '':
1359  if restore is False:
1360  if not hasattr(lg, self.ROTATED_ATTRIBUTE_NAME) or not getattr(lg, self.ROTATED_ATTRIBUTE_NAME):
1361  self.fnameOld = fname
1362  fname += fileNameSuffix
1363  pin = lfn.getFreeProcInstanceNumber(os.path.basename(fname))
1364  if pin != '' and ((pin != '0' and fileNameSuffix == '') or (pin == '0' and fileNameSuffix != '')):
1365  pin = '.' + pin + '.log'
1366  fname = lfn.findReplace(fname + pin, rollover=rollover)
1367  setattr(lg, self.ROTATED_ATTRIBUTE_NAME, True)
1368  lg = logging.getLogger(ln)
1369  setattr(lg, self.ROTATED_ATTRIBUTE_NAME, True)
1370  else:
1371  if self.fnameOld != '':
1372  fname = lfn.findReplace(self.fnameOld, rollover=rollover)
1373  lg = logging.getLogger(ln)
1374  return lg
1375  except Exception, err:
1376  raise Exception('Logger initialization error:' + str(err) + "\n" + getTracebackInfo())
1377 
1378 
def getTracebackInfo(linesNumberMax=None)
Definition: Utils.py:218
Here is the call graph for this function:

Member Data Documentation

◆ fnameOld

app.Utils.MPLogger.fnameOld

Definition at line 1334 of file Utils.py.

◆ ROTATED_ATTRIBUTE_NAME

string app.Utils.MPLogger.ROTATED_ATTRIBUTE_NAME = '__rotated'
static

Definition at line 1328 of file Utils.py.


The documentation for this class was generated from the following file: