1 8 9 package org.jivesoftware.util.log; 10 11 import java.io.ObjectStreamException ; 12 import java.io.Serializable ; 13 14 21 public final class LogEvent 22 implements Serializable { 23 private final static long START_TIME = System.currentTimeMillis(); 25 26 private String m_category; 28 29 private String m_message; 31 32 private Throwable m_throwable; 34 35 private long m_time; 37 38 private Priority m_priority; 40 41 private ContextMap m_contextMap; 43 44 49 public final Priority getPriority() { 50 return m_priority; 51 } 52 53 58 public final void setPriority(final Priority priority) { 59 m_priority = priority; 60 } 61 62 67 public final ContextMap getContextMap() { 68 return m_contextMap; 69 } 70 71 76 public final void setContextMap(final ContextMap contextMap) { 77 m_contextMap = contextMap; 78 } 79 80 91 104 109 public final String getCategory() { 110 return m_category; 111 } 112 113 118 public final String getMessage() { 119 return m_message; 120 } 121 122 127 public final Throwable getThrowable() { 128 return m_throwable; 129 } 130 131 136 public final long getTime() { 137 return m_time; 138 } 139 140 145 public final long getRelativeTime() { 146 return m_time - START_TIME; 147 } 148 149 154 public final void setCategory(final String category) { 155 m_category = category; 156 } 157 158 163 public final void setMessage(final String message) { 164 m_message = message; 165 } 166 167 172 public final void setThrowable(final Throwable throwable) { 173 m_throwable = throwable; 174 } 175 176 181 public final void setTime(final long time) { 182 m_time = time; 183 } 184 185 186 192 private Object readResolve() 193 throws ObjectStreamException { 194 if (null == m_category) m_category = ""; 195 if (null == m_message) m_message = ""; 196 197 String priorityName = ""; 198 if (null != m_priority) { 199 priorityName = m_priority.getName(); 200 } 201 202 m_priority = Priority.getPriorityForName(priorityName); 203 204 return this; 205 } 206 } 207 | Popular Tags |