Skip to content

Commit

Permalink
use sprintf un toString
Browse files Browse the repository at this point in the history
  • Loading branch information
colinsurprenant authored and jordansissel committed Dec 10, 2015
1 parent aef6b5a commit aaaa6de
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions logstash-core-event-java/src/main/java/com/logstash/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ public Event clone()
}

public String toString() {
// TODO: until we have sprintf
String host = (String)this.data.getOrDefault("host", "%{host}");
String message = (String)this.data.getOrDefault("message", "%{message}");
// TODO: (colin) clean this IOException handling, not sure why we bubble IOException here
try {
return getTimestamp().toIso8601() + " " + host + " " + message;
return (getTimestamp().toIso8601() + " " + this.sprintf("%{host} %{message}"));
} catch (IOException e) {
return host + " " + message;
String host = (String)this.data.getOrDefault("host", "%{host}");
String message = (String)this.data.getOrDefault("message", "%{message}");
return (host + " " + message);
}
}

Expand Down

0 comments on commit aaaa6de

Please sign in to comment.