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):
|
def _pretty(self, pid, color, s):
|
||||||
if vars.DEBUG_PIDS:
|
if vars.DEBUG_PIDS:
|
||||||
redo = '%d redo ' % pid
|
redo = '%-6d redo ' % pid
|
||||||
else:
|
else:
|
||||||
redo = 'redo '
|
redo = 'redo '
|
||||||
self.file.write(''.join([color, redo, vars.DEPTH,
|
self.file.write(''.join([color, redo, vars.DEPTH,
|
||||||
|
|
@ -115,16 +115,13 @@ def write(s):
|
||||||
_log.write(s)
|
_log.write(s)
|
||||||
|
|
||||||
|
|
||||||
def meta(kind, s):
|
def meta(kind, s, pid=None):
|
||||||
_log.meta(kind, s)
|
|
||||||
|
|
||||||
|
|
||||||
def meta(kind, s):
|
|
||||||
assert(':' not in kind)
|
assert(':' not in kind)
|
||||||
assert('@' not in kind)
|
assert('@' not in kind)
|
||||||
assert('\n' not in s)
|
assert('\n' not in s)
|
||||||
|
if pid == None: pid = os.getpid()
|
||||||
write('@@REDO:%s:%d:%.4f@@ %s'
|
write('@@REDO:%s:%d:%.4f@@ %s'
|
||||||
% (kind, os.getpid(), time.time(), s))
|
% (kind, pid, time.time(), s))
|
||||||
|
|
||||||
def err(s):
|
def err(s):
|
||||||
s = s.rstrip()
|
s = s.rstrip()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import errno, fcntl, os, re, struct, sys, termios, time
|
import errno, fcntl, os, re, struct, sys, termios, time
|
||||||
|
from atoi import atoi
|
||||||
import options
|
import options
|
||||||
|
|
||||||
optspec = """
|
optspec = """
|
||||||
|
|
@ -164,12 +165,13 @@ def catlog(t):
|
||||||
# logs.PrettyLog does it, but only if we actually call .write().
|
# logs.PrettyLog does it, but only if we actually call .write().
|
||||||
words, text = g.groups()
|
words, text = g.groups()
|
||||||
kind, pid, when = words.split(':')[0:3]
|
kind, pid, when = words.split(':')[0:3]
|
||||||
|
pid = atoi(pid)
|
||||||
if kind == 'unchanged':
|
if kind == 'unchanged':
|
||||||
if opt.unchanged:
|
if opt.unchanged:
|
||||||
if opt.debug_locks:
|
if opt.debug_locks:
|
||||||
logs.write(line.rstrip())
|
logs.write(line.rstrip())
|
||||||
elif text not in already:
|
elif text not in already:
|
||||||
logs.meta('do', text)
|
logs.meta('do', text, pid=pid)
|
||||||
if opt.recursive:
|
if opt.recursive:
|
||||||
if loglock: loglock.unlock()
|
if loglock: loglock.unlock()
|
||||||
catlog(text)
|
catlog(text)
|
||||||
|
|
@ -178,7 +180,7 @@ def catlog(t):
|
||||||
if opt.debug_locks:
|
if opt.debug_locks:
|
||||||
logs.write(line.rstrip())
|
logs.write(line.rstrip())
|
||||||
elif text not in already:
|
elif text not in already:
|
||||||
logs.meta('do', text)
|
logs.meta('do', text, pid=pid)
|
||||||
if opt.recursive:
|
if opt.recursive:
|
||||||
assert text
|
assert text
|
||||||
if loglock: loglock.unlock()
|
if loglock: loglock.unlock()
|
||||||
|
|
@ -227,7 +229,7 @@ try:
|
||||||
while queue:
|
while queue:
|
||||||
t = queue.pop(0)
|
t = queue.pop(0)
|
||||||
if t != '-':
|
if t != '-':
|
||||||
logs.meta('do', t)
|
logs.meta('do', t, pid=0)
|
||||||
catlog(t)
|
catlog(t)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit(200)
|
sys.exit(200)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue