Mercurial > hg > drupalISMI
comparison importFromOpenMind/importer/check_ismi_transaction_log.py @ 49:f8cd7db4178c
output number of checked saves.
author | casties |
---|---|
date | Thu, 23 Feb 2017 19:57:05 +0100 |
parents | 4692e90215eb |
children | 1be17309db79 |
comparison
equal
deleted
inserted
replaced
48:6625019a0c96 | 49:f8cd7db4178c |
---|---|
8 | 8 |
9 # do not output deleted nodes | 9 # do not output deleted nodes |
10 omitDeleted = True | 10 omitDeleted = True |
11 | 11 |
12 # active log levels for logging | 12 # active log levels for logging |
13 logLevels = {'DEBUG', 'INFO', 'WARNING', 'ERROR', 'SYSMSG'} | 13 #logLevels = {'DEBUG', 'INFO', 'WARNING', 'ERROR', 'SYSMSG'} |
14 #logLevels = {'INFO', 'WARNING', 'ERROR', 'SYSMSG'} | 14 #logLevels = {'INFO', 'WARNING', 'ERROR', 'SYSMSG'} |
15 #logLevels = {'ERROR', 'SYSMSG'} | 15 logLevels = {'ERROR', 'SYSMSG'} |
16 | 16 |
17 def log(level, message): | 17 def log(level, message): |
18 if level in logLevels: | 18 if level in logLevels: |
19 print("%s: %s"%(level, message)) | 19 print("%s: %s"%(level, message)) |
20 | 20 |
280 outFile = open(outFilename, mode='w') | 280 outFile = open(outFilename, mode='w') |
281 printHeaderCsv(outFile) | 281 printHeaderCsv(outFile) |
282 | 282 |
283 with open(inFilename) as f: | 283 with open(inFilename) as f: |
284 linecnt = 0 | 284 linecnt = 0 |
285 savecnt = 0 | |
285 saving = 0 | 286 saving = 0 |
286 openSaves = {} | 287 openSaves = {} |
287 savingPrev = 0 | 288 savingPrev = 0 |
288 deleting = 0 | 289 deleting = 0 |
289 saveCtx = None | 290 saveCtx = None |
295 linecnt += 1 | 296 linecnt += 1 |
296 # | 297 # |
297 # parsing lines in order of specific match, not order of operation! | 298 # parsing lines in order of specific match, not order of operation! |
298 # | 299 # |
299 if '*** START Saving' in line: | 300 if '*** START Saving' in line: |
301 savecnt += 1 | |
300 saving += 1 | 302 saving += 1 |
301 # make sure delete is off | 303 # make sure delete is off |
302 deleting = 0 | 304 deleting = 0 |
303 log('DEBUG', line) | 305 log('DEBUG', line) |
304 # parse time and id | 306 # parse time and id |
463 | 465 |
464 if len(prevSaves) > 0: | 466 if len(prevSaves) > 0: |
465 log('ERROR', "%s unprocessed previous saves!"%len(prevSaves)) | 467 log('ERROR', "%s unprocessed previous saves!"%len(prevSaves)) |
466 log('DEBUG', prevSaves) | 468 log('DEBUG', prevSaves) |
467 | 469 |
468 log("SYSMSG", "%s lines of logfile scanned"%linecnt) | 470 log("SYSMSG", "%s form saves in %s lines of logfile"%(savecnt, linecnt)) |
469 | 471 |
470 | 472 |
471 # | 473 # |
472 # public static void main :-) | 474 # public static void main :-) |
473 # | 475 # |