4 from sys import stdout,stdin,argv,exit
6 if len(argv) > 1 and argv[1] in ['-h', '-?', '--h', '--help']:
7 print 'pplog.py pretty prints Open Daylight log lines, useful for lines containing large nested objects'
8 print 'Usage: Simply pipe the lines you are interested through this script'
15 stdout.write('\n' + i)
18 if '|' not in l: continue
20 (t, level, component, cat, art, msg) = string.split(l, '|', maxsplit=5)
34 if in_ws and c in ' \t': continue
39 if not is_empty_list and last_char not in closer: nl()
47 if last_char in closer and c != ',': nl()
50 if not c in opener: title += c
55 (t,ln) = title_stack.pop()
56 if (line_num - ln) > 5: stdout.write(' /* ' + t.strip() + ' */')
63 title_stack.append((title, line_num))