Interface SyslogParser
public interface SyslogParser
SyslogParser defines an interface for classes that parse Syslog into Map.-
Method Summary
Modifier and TypeMethodDescriptionParse aStringto aMap.voidParse aStringto aMapand provides thatMapto the providedConsumer.parseLines(Reader reader) Reads each line from theReaderand parses it to aListofMap.voidparseLines(Reader reader, java.util.function.Consumer<Map<String, Object>> consumer) Reads each line from theReaderand parses it toMap, which is passed to the providedConsumer.voidparseLines(Reader reader, java.util.function.Consumer<Map<String, Object>> messageConsumer, java.util.function.BiConsumer<String, Throwable> errorConsumer) Reads each line from theReaderand parses it toMap, which is passed to the providedConsumer.
-
Method Details
-
parseLine
Parse aStringto aMap.- Parameters:
line- the line of Syslog to parse- Returns:
- a
Map - Throws:
ParseException- if there is an error parsing
-
parseLine
Parse aStringto aMapand provides thatMapto the providedConsumer.- Parameters:
line- the line of Syslog to parserconsumer- theConsumer- Throws:
ParseException- if there is an error parsing
-
parseLines
Reads each line from theReaderand parses it to aListofMap.- Parameters:
reader-Readerused. It is not closed in this method.- Returns:
ListofMap- Throws:
ParseException- if there is an error parsingIllegalArgumentException- if reader is null
-
parseLines
Reads each line from theReaderand parses it toMap, which is passed to the providedConsumer.- Parameters:
reader-Readerused. It is not closed in this method.consumer- theConsumer- Throws:
ParseException- if there is an error parsing any lineIllegalArgumentException- if reader or consumer are null
-
parseLines
void parseLines(Reader reader, java.util.function.Consumer<Map<String, Object>> messageConsumer, java.util.function.BiConsumer<String, Throwable> errorConsumer) Reads each line from theReaderand parses it toMap, which is passed to the providedConsumer. For any line where aParseExceptionwould be thrown, it will will be passed to the errorConsumer.- Parameters:
reader-Readerused. It is not closed in this method.messageConsumer- theConsumerfor messageserrorConsumer- theConsumerfor syslog lines and their errors.- Throws:
IllegalArgumentException- if reader, messageConsumer, or errorConsumer are null
-