001    package hirondelle.web4jtools.logview.parser;
002    
003    import hirondelle.web4jtools.logview.parsedview.LoggerRecord;
004    import hirondelle.web4jtools.logview.parsedview.ParsedCriteria;
005    import java.util.List;
006    
007    /**
008    * Generic interface for parsing an entire log file into specific records.
009    * 
010    * <P>A single implementation of this interface is provided, which parses 
011    * logs in the format emitted by default by JDK loggers. This is the 
012    * default format for both the WEB4J framework classes, and the popular 
013    * Tomcat server.
014    * 
015    * <P>If your application or server uses a different log file format, then you 
016    * will need to 
017    *<ul>
018    * <li>supply a new implementation of this interface
019    * <li>amend the implementation of {@link hirondelle.web4jtools.logview.parser.LogParserInstance}
020    *</ul>
021    */
022    public interface LogParser {
023    
024      /**
025      * Parse the contents of a log file into {@link LoggerRecord} objects.
026      * 
027      * <P><em>Design Note</em><br>
028      * This interface does not use streams. Streams would likely be more 
029      * performant in handling large files. However, since this tool is meant as 
030      * a <em>development</em> tool, and not for production (because of 
031      * security concerns), this is usually acceptable, since during development 
032      * log files rarely become excessively large.
033      */
034      List<LoggerRecord> parse(String aLogFileContents, ParsedCriteria aCriteria);
035      
036    }