Skip to content

Commit

Permalink
introduced variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Jae-Yoon Chung committed Dec 10, 2014
1 parent 782dbe1 commit 3672746
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/rosgraph/src/rosgraph/roslogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,23 @@ def emit(self, record):
msg = os.environ['ROSCONSOLE_FORMAT']
msg = msg.replace('${severity}', level)
msg = msg.replace('${message}', str(record.getMessage()))
msg = msg.replace('${time}', str(time.time()))
msg = msg.replace('${walltime}', '%f' % time.time())
msg = msg.replace('${thread}', str(record.thread))
msg = msg.replace('${logger}', str(record.name))
msg = msg.replace('${file}', str(record.pathname))
msg = msg.replace('${line}', str(record.lineno))
msg = msg.replace('${function}', str(record.funcName))
try:
from rospy import get_name
msg = msg.replace('${node}', get_name())
node_name = get_name()
except ImportError:
msg = msg.replace('${node}', 'unavailable')
node_name = '<unknown_node_name>'
msg = msg.replace('${node}', node_name)
if self._get_time is not None and not self._is_wallclock():
msg += ' [%f]' % self._get_time()
t = self._get_time()
else:
t = time.time()
msg = msg.replace('${time}', '%f' % t)
msg += '\n'
else:
msg = '[%s] [WallTime: %f]' % (level, time.time())
Expand Down

0 comments on commit 3672746

Please sign in to comment.