Mercurial > public > mercurial-scm > hg
diff hgext/blackbox.py @ 26185:e8f9dffca36f
blackbox: add pid to output
This adds the process id to the line header for the blackbox output. This is
useful for distinguishing processes when using the blackbox on a server and many
processes are writing to the blackbox at once.
author | Durham Goode <durham@fb.com> |
---|---|
date | Mon, 07 Sep 2015 11:31:44 -0700 |
parents | 328739ea70c3 |
children | ab6468270b83 |
line wrap: on
line diff
--- a/hgext/blackbox.py Mon Sep 07 17:08:35 2015 -0700 +++ b/hgext/blackbox.py Mon Sep 07 11:31:44 2015 -0700 @@ -107,9 +107,11 @@ if blackbox: date = util.datestr(None, '%Y/%m/%d %H:%M:%S') user = util.getuser() + pid = str(os.getpid()) formattedmsg = msg[0] % msg[1:] try: - blackbox.write('%s %s> %s' % (date, user, formattedmsg)) + blackbox.write('%s %s (%s)> %s' % + (date, user, pid, formattedmsg)) except IOError as err: self.debug('warning: cannot write to blackbox.log: %s\n' % err.strerror)