Source:
<code>public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof Position) { Position position = (Position) msg; try { Context.getDeviceManager().updateLatestPosition(position); } catch (SQLException error) { LOGGER.warn("Failed to update device", error); } String uniqueId = Context.getIdentityManager().getById(position.getDeviceId()).getUniqueId(); StringBuilder s = new StringBuilder(); s.append(formatChannel(ctx.channel())).append(" "); s.append("id: ").append(uniqueId); s.append(", time: ").append(DateUtil.formatDate(position.getFixTime(), false)); 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())); } <START> if (position.getOutdated()) { <END> s.append(", outdated"); } if (!position.getValid()) { s.append(", invalid"); } Object batteryLevel = position.getInteger(Position.KEY_BATTERY_LEVEL, null); if (batteryLevel != null) { s.append(", battery: ").append(batteryLevel).append('%'); } Object cmdResult = position.getAttributes().get(Position.KEY_RESULT); if (cmdResult != null) { s.append(", result: ").append(cmdResult); } LOGGER.info(s.toString()); Context.getStatisticsManager().registerMessageStored(position.getDeviceId()); } }</code><technical_language>I prefer avoid adding more logging</technical_language>

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof Position) { Position position = (Position) msg; try { Context.getDeviceManager().updateLatestPosition(position); } catch (SQLException error) { LOGGER.warn("Failed to update device", error); } String uniqueId = Context.getIdentityManager().getById(position.getDeviceId()).getUniqueId(); StringBuilder s = new StringBuilder(); s.append(formatChannel(ctx.channel())).append(" "); s.append("id: ").append(uniqueId); for (String event : logEvents) { switch (event) { case "time": s.append(", time: ").append(DateUtil.formatDate(position.getFixTime(), false)); break; case "position": s.append(", lat: ").append(String.format("%.5f", position.getLatitude())); s.append(", lon: ").append(String.format("%.5f", position.getLongitude())); break; case "speed": if (position.getSpeed() > 0) { s.append(", speed: ").append(String.format("%.1f", position.getSpeed())); } break; case "course": s.append(", course: ").append(String.format("%.1f", position.getCourse())); break; case "accuracy": if (position.getAccuracy() > 0) { s.append(", accuracy: ").append(String.format("%.1f", position.getAccuracy())); } break; case "outdated": if (position.getOutdated()) { s.append(", outdated"); } break; case "invalid": if (!position.getValid()) { s.append(", invalid"); } break; default: Object value = position.getAttributes().get(event); if (value != null) { s.append(", ").append(event).append(": ").append(value); } break; } } LOGGER.info(s.toString()); Context.getStatisticsManager().registerMessageStored(position.getDeviceId()); } }