You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
666 B
16 lines
666 B
4 years ago
|
from logging import StreamHandler
|
||
|
|
||
|
class LoggerHandlerDumpLogList(StreamHandler):
|
||
|
def __init__(self, inDict, inKeyStr, inHashKeyStr, inRowCountInt):
|
||
|
StreamHandler.__init__(self)
|
||
|
self.Dict = inDict
|
||
|
self.KeyStr = inKeyStr
|
||
|
self.HashKeyStr = inHashKeyStr
|
||
|
self.RowCountInt = inRowCountInt
|
||
|
self.Dict[self.HashKeyStr]="0"
|
||
|
def emit(self, inRecord):
|
||
|
inMessageStr = self.format(inRecord)
|
||
|
self.Dict[self.KeyStr].append(inMessageStr)
|
||
|
self.Dict[self.HashKeyStr]=str(int(self.Dict[self.HashKeyStr])+1)
|
||
|
if len(self.Dict[self.KeyStr])>self.RowCountInt:
|
||
|
self.Dict[self.KeyStr].pop(0)
|