redo-log: --debug-pids works properly again.
Pretty-printing from redo-log was accidentally using the redo-log pid instead of the pid parsed from the raw logs.
This commit is contained in:
parent
bc632982fc
commit
f49d311471
2 changed files with 9 additions and 10 deletions
11
logs.py
11
logs.py
|
|
@ -40,7 +40,7 @@ class PrettyLog(object):
|
|||
|
||||
def _pretty(self, pid, color, s):
|
||||
if vars.DEBUG_PIDS:
|
||||
redo = '%d redo ' % pid
|
||||
redo = '%-6d redo ' % pid
|
||||
else:
|
||||
redo = 'redo '
|
||||
self.file.write(''.join([color, redo, vars.DEPTH,
|
||||
|
|
@ -115,16 +115,13 @@ def write(s):
|
|||
_log.write(s)
|
||||
|
||||
|
||||
def meta(kind, s):
|
||||
_log.meta(kind, s)
|
||||
|
||||
|
||||
def meta(kind, s):
|
||||
def meta(kind, s, pid=None):
|
||||
assert(':' not in kind)
|
||||
assert('@' not in kind)
|
||||
assert('\n' not in s)
|
||||
if pid == None: pid = os.getpid()
|
||||
write('@@REDO:%s:%d:%.4f@@ %s'
|
||||
% (kind, os.getpid(), time.time(), s))
|
||||
% (kind, pid, time.time(), s))
|
||||
|
||||
def err(s):
|
||||
s = s.rstrip()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
import errno, fcntl, os, re, struct, sys, termios, time
|
||||
from atoi import atoi
|
||||
import options
|
||||
|
||||
optspec = """
|
||||
|
|
@ -164,12 +165,13 @@ def catlog(t):
|
|||
# logs.PrettyLog does it, but only if we actually call .write().
|
||||
words, text = g.groups()
|
||||
kind, pid, when = words.split(':')[0:3]
|
||||
pid = atoi(pid)
|
||||
if kind == 'unchanged':
|
||||
if opt.unchanged:
|
||||
if opt.debug_locks:
|
||||
logs.write(line.rstrip())
|
||||
elif text not in already:
|
||||
logs.meta('do', text)
|
||||
logs.meta('do', text, pid=pid)
|
||||
if opt.recursive:
|
||||
if loglock: loglock.unlock()
|
||||
catlog(text)
|
||||
|
|
@ -178,7 +180,7 @@ def catlog(t):
|
|||
if opt.debug_locks:
|
||||
logs.write(line.rstrip())
|
||||
elif text not in already:
|
||||
logs.meta('do', text)
|
||||
logs.meta('do', text, pid=pid)
|
||||
if opt.recursive:
|
||||
assert text
|
||||
if loglock: loglock.unlock()
|
||||
|
|
@ -227,7 +229,7 @@ try:
|
|||
while queue:
|
||||
t = queue.pop(0)
|
||||
if t != '-':
|
||||
logs.meta('do', t)
|
||||
logs.meta('do', t, pid=0)
|
||||
catlog(t)
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(200)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue