Sometimes we want to parse "cee" rfc3164 messages without parsing the JSON in the message body. If we just want access to syslog headers, not parsing the JSON saves quite a bit of time. This PR adds an optional function argument ( "OptionDontParseJSON" ) that may be passed to the NewParser and NewSyslogMsg constructors to tell the parser to save "cee" message content without actually parsing it.
If JSON values are added to the message after the original parse, and SyslogMsg.String(), SyslogMsg.Bytes(), or SyslogMsg.JSON() are called, the message content will be parsed at that time in order to combine the fields within it with any fields added to SyslogMsg.JSONValues. Otherwise, SyslogMsg.Content will be used without ever incurring the penalty of a JSON parse.
This PR also fixes some minor golint / go vet issues.
Sometimes we want to parse "cee" rfc3164 messages without parsing the JSON in the message body. If we just want access to syslog headers, not parsing the JSON saves quite a bit of time. This PR adds an optional function argument ( "OptionDontParseJSON" ) that may be passed to the NewParser and NewSyslogMsg constructors to tell the parser to save "cee" message content without actually parsing it.
If JSON values are added to the message after the original parse, and SyslogMsg.String(), SyslogMsg.Bytes(), or SyslogMsg.JSON() are called, the message content will be parsed at that time in order to combine the fields within it with any fields added to SyslogMsg.JSONValues. Otherwise, SyslogMsg.Content will be used without ever incurring the penalty of a JSON parse.
This PR also fixes some minor golint / go vet issues.