1 package com.github.triceo.splitlog.api; 2 3 import java.util.Date; 4 import java.util.List; 5 6 /** 7 * A set of lines from the watched file, that is likely to constitute a single 8 * log message. No two messages are allowed to be equal, unless they have the 9 * same {@link #getUniqueId()}. 10 */ 11 public interface Message { 12 13 /** 14 * Get the date that this message was logged on. 15 * 16 * @return Newly constructed instance of {@link Date} with the message log 17 * timestamp. 18 */ 19 Date getDate(); 20 21 /** 22 * Get data about exception included in this message. 23 * 24 * @return Exception data, if {@link #hasException()} returns true. Null in 25 * any other case. 26 */ 27 ExceptionDescriptor getExceptionDescriptor(); 28 29 /** 30 * Get each line of the message. 31 * 32 * @return Unmodifiable representation of lines in this message, exactly as 33 * were received. 34 */ 35 List<String> getLines(); 36 37 /** 38 * Get each line of the message, with metadata stripped out. 39 * 40 * @return Unmodifiable representation of text of the message. 41 */ 42 List<String> getLinesWithoutMetadata(); 43 44 /** 45 * Return a message that preceded this one in the same log stream. 46 * 47 * @return Null if there was no such message, the message already got GC'd, 48 * or <code>{@link #getType()} == {@link MessageType#TAG}</code>. 49 */ 50 Message getPreviousMessage(); 51 52 MessageSeverity getSeverity(); 53 54 MessageType getType(); 55 56 /** 57 * Unique ID of the message, that can be used to compare messages in the 58 * order of their arrival into this tool. 59 * 60 * @return ID of the message, guaranteed to be unique for every message, and 61 * increasing from message to message. 62 */ 63 long getUniqueId(); 64 65 boolean hasException(); 66 67 }