Skip to content

Commit

Permalink
fix(replica): add formating in logs
Browse files Browse the repository at this point in the history
Signed-off-by: Utkarsh Mani Tripathi <utkarsh.tripathi@mayadata.io>
  • Loading branch information
Utkarsh Mani Tripathi committed Feb 19, 2019
1 parent 31318fb commit a99f98a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,27 @@ func timed(f operation, msg *Message) {
msgType := msg.Type
start := time.Now()
f(msg)
timeSinceStart := time.Since(start)
timeSinceStart := time.Since(start).Seconds()
switch msgType {
case TypeRead:
if timeSinceStart > opReadTimeout {
logrus.Warning("Read time: %d greater than read timeout: %d at controller", opReadTimeout)
logrus.Warningf("Read time: %ds greater than read timeout: %ds at controller", timeSinceStart, opReadTimeout)
}
case TypeWrite:
if timeSinceStart > opWriteTimeout {
logrus.Warning("Write time: %d greater than write timeout: %d at controller", opWriteTimeout)
logrus.Warningf("Write time: %ds greater than write timeout: %ds at controller", timeSinceStart, opWriteTimeout)
}
case TypeSync:
if timeSinceStart > opSyncTimeout {
logrus.Warning("Sync time: %d greater than sync timeout: %d at controller", opSyncTimeout)
logrus.Warningf("Sync time: %ds greater than sync timeout: %ds at controller", timeSinceStart, opSyncTimeout)
}
case TypeUnmap:
if timeSinceStart > opUnmapTimeout {
logrus.Warning("Unmap time: %d greater than unmap timeout: %d at controller", opUnmapTimeout)
logrus.Warningf("Unmap time: %ds greater than unmap timeout: %ds at controller", timeSinceStart, opUnmapTimeout)
}
case TypePing:
if timeSinceStart > opPingTimeout {
logrus.Warning("Ping time: %d greater than ping timeout: %d at controller", opPingTimeout)
logrus.Warningf("Ping time: %ds greater than ping timeout: %ds at controller", timeSinceStart, opPingTimeout)
}
}
}
Expand Down

0 comments on commit a99f98a

Please sign in to comment.