aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-04-07 15:24:04 +1200
committerGitHub <noreply@github.com>2018-04-07 15:24:04 +1200
commit179a3fdc36ce1c24f72b1a3bc2efbde33a02011d (patch)
tree56089634cedd016c0915b0a9505feea3eb56f51f /src
parent590dbd630b8ceddab01d45119f63d55f21140721 (diff)
parent8d0dadde10bad915c4571d227ccb17a2810a44bb (diff)
downloadtrackermap-server-179a3fdc36ce1c24f72b1a3bc2efbde33a02011d.tar.gz
trackermap-server-179a3fdc36ce1c24f72b1a3bc2efbde33a02011d.tar.bz2
trackermap-server-179a3fdc36ce1c24f72b1a3bc2efbde33a02011d.zip
Merge pull request #3837 from ivanfmartinez/accuracy_in_log
add position accuracy to log
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/MainEventHandler.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java
index 8e88e15b9..6228f3709 100644
--- a/src/org/traccar/MainEventHandler.java
+++ b/src/org/traccar/MainEventHandler.java
@@ -60,13 +60,18 @@ public class MainEventHandler extends IdleStateAwareChannelHandler {
// Log position
StringBuilder s = new StringBuilder();
s.append(formatChannel(e.getChannel())).append(" ");
- s.append("id: ").append(uniqueId).append(", ");
- s.append("time: ").append(
- new SimpleDateFormat(Log.DATE_FORMAT).format(position.getFixTime())).append(", ");
- s.append("lat: ").append(String.format("%.5f", position.getLatitude())).append(", ");
- s.append("lon: ").append(String.format("%.5f", position.getLongitude())).append(", ");
- s.append("speed: ").append(String.format("%.1f", position.getSpeed())).append(", ");
- s.append("course: ").append(String.format("%.1f", position.getCourse()));
+ s.append("id: ").append(uniqueId);
+ s.append(", time: ").append(
+ new SimpleDateFormat(Log.DATE_FORMAT).format(position.getFixTime()));
+ s.append(", lat: ").append(String.format("%.5f", position.getLatitude()));
+ s.append(", lon: ").append(String.format("%.5f", position.getLongitude()));
+ if (position.getSpeed() > 0) {
+ s.append(", speed: ").append(String.format("%.1f", position.getSpeed()));
+ }
+ s.append(", course: ").append(String.format("%.1f", position.getCourse()));
+ if (position.getAccuracy() > 0) {
+ s.append(", accuracy: ").append(String.format("%.1f", position.getAccuracy()));
+ }
Object cmdResult = position.getAttributes().get(Position.KEY_RESULT);
if (cmdResult != null) {
s.append(", result: ").append(cmdResult);