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

    
https://github.com/apache/metron-bro-plugin-kafka/pull/6#discussion_r172192869
  
    --- Diff: src/KafkaWriter.cc ---
    @@ -54,20 +66,49 @@ KafkaWriter::KafkaWriter(WriterFrontend* frontend): 
WriterBackend(frontend), for
     }
     
     KafkaWriter::~KafkaWriter()
    -{}
    +{
    +
    +    // Cleanup all the things
    +    delete topic;
    +    delete producer;
    +    delete formatter;
    +    delete conf;
    +    delete topic_conf;
    +
    +}
     
     bool KafkaWriter::DoInit(const WriterInfo& info, int num_fields, const 
threading::Field* const* fields)
     {
    +    // Timeformat object, default to TS_EPOCH
    +    threading::formatter::JSON::TimeFormat tf = 
threading::formatter::JSON::TS_EPOCH;
    +
         // if no global 'topic_name' is defined, use the log stream's 'path'
         if(topic_name.empty()) {
             topic_name = info.path;
         }
     
    +    // format timestamps
    +    if ( strcmp(json_timestamps.c_str(), "JSON::TS_EPOCH") == 0 ) {
    --- End diff --
    
    Just curious, why do we treat `json_timestamps` as a string?  Why not just 
treat it as a `JSON::TimestampFormat`?  Wouldn't that simplify a lot of this 
logic and remove all of the string comparison and string copy logic?


---

Reply via email to