Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2458#discussion_r157090966
  
    --- Diff: storm-core/src/jvm/org/apache/storm/metric/IEventLogger.java ---
    @@ -31,32 +32,54 @@
         /**
          * A wrapper for the fields that we would log.
          */
    -    public static class EventInfo {
    -        String ts;
    -        String component;
    -        String task;
    -        String messageId;
    -        String values;
    -        EventInfo(String ts, String component, String task, String 
messageId, String values) {
    +    class EventInfo {
    +        private long ts;
    +        private String component;
    +        private int task;
    +        private Object messageId;
    +        private List<Object> values;
    +
    +        public EventInfo(long ts, String component, int task, Object 
messageId, List<Object> values) {
                 this.ts = ts;
                 this.component = component;
                 this.task = task;
                 this.messageId = messageId;
                 this.values = values;
             }
     
    +        public long getTs() {
    +            return ts;
    +        }
    +
    +        public String getComponent() {
    +            return component;
    +        }
    +
    +        public int getTask() {
    +            return task;
    +        }
    +
    +        public Object getMessageId() {
    +            return messageId;
    +        }
    +
    +        public List<Object> getValues() {
    +            return values;
    +        }
    +
             /**
              * Returns a default formatted string with fields separated by ","
              *
              * @return a default formatted string with fields separated by ","
              */
             @Override
             public String toString() {
    -            return new Date(Long.parseLong(ts)).toString() + "," + 
component + "," + task + "," + messageId + "," + values;
    +            return new Date(ts).toString() + "," + component + "," + 
String.valueOf(task) + ","
    --- End diff --
    
    Instead of doing that, I just open possibility to extend 
FileBasedEventLogger easily. Users can simply extend FileBasedEventLogger and 
override `buildLogMessage(EventInfo)` to provide the log line.


---

Reply via email to