Browse Source

Put peer at RHS of sessions log.

Then IPv6 addresses don't mess up the formatting.
master
Neil Booth 8 years ago
parent
commit
645e60eaee
  1. 12
      server/protocol.py

12
server/protocol.py

@ -479,13 +479,13 @@ class ServerManager(util.LoggedClass):
return ('{:3d}:{:02d}:{:02d}' return ('{:3d}:{:02d}:{:02d}'
.format(t // 3600, (t % 3600) // 60, t % 60)) .format(t // 3600, (t % 3600) // 60, t % 60))
fmt = ('{:<6} {:<5} {:>23} {:>15} {:>5} {:>5} ' fmt = ('{:<6} {:<5} {:>15} {:>5} {:>5} '
'{:>7} {:>7} {:>7} {:>7} {:>7} {:>9}') '{:>7} {:>7} {:>7} {:>7} {:>7} {:>9} {:>21}')
yield fmt.format('ID', 'Flags', 'Peer', 'Client', 'Reqs', 'Txs', yield fmt.format('ID', 'Flags', 'Client', 'Reqs', 'Txs', 'Subs',
'Subs', 'Recv', 'Recv KB', 'Sent', 'Sent KB', 'Time') 'Recv', 'Recv KB', 'Sent', 'Sent KB', 'Time', 'Peer')
for (id_, flags, peer, client, reqs, txs_sent, subs, for (id_, flags, peer, client, reqs, txs_sent, subs,
recv_count, recv_size, send_count, send_size, time) in data: recv_count, recv_size, send_count, send_size, time) in data:
yield fmt.format(id_, flags, peer, client, yield fmt.format(id_, flags, client,
'{:,d}'.format(reqs), '{:,d}'.format(reqs),
'{:,d}'.format(txs_sent), '{:,d}'.format(txs_sent),
'{:,d}'.format(subs), '{:,d}'.format(subs),
@ -493,7 +493,7 @@ class ServerManager(util.LoggedClass):
'{:,d}'.format(recv_size // 1024), '{:,d}'.format(recv_size // 1024),
'{:,d}'.format(send_count), '{:,d}'.format(send_count),
'{:,d}'.format(send_size // 1024), '{:,d}'.format(send_size // 1024),
time_fmt(time)) time_fmt(time), peer)
def session_data(self, for_log): def session_data(self, for_log):
'''Returned to the RPC 'sessions' call.''' '''Returned to the RPC 'sessions' call.'''

Loading…
Cancel
Save