diff options
Diffstat (limited to 'src/net/java/sip/communicator/impl/notification/LogMessageNotificationHandlerImpl.java')
-rw-r--r-- | src/net/java/sip/communicator/impl/notification/LogMessageNotificationHandlerImpl.java | 66 |
1 files changed, 11 insertions, 55 deletions
diff --git a/src/net/java/sip/communicator/impl/notification/LogMessageNotificationHandlerImpl.java b/src/net/java/sip/communicator/impl/notification/LogMessageNotificationHandlerImpl.java index 55fe13d..7ac671b 100644 --- a/src/net/java/sip/communicator/impl/notification/LogMessageNotificationHandlerImpl.java +++ b/src/net/java/sip/communicator/impl/notification/LogMessageNotificationHandlerImpl.java @@ -8,6 +8,7 @@ package net.java.sip.communicator.impl.notification; import net.java.sip.communicator.service.notification.*; import net.java.sip.communicator.util.*; +import static net.java.sip.communicator.service.notification.LogMessageNotificationAction.*; /** * An implementation of the <tt>LogMessageNotificationHandler</tt> interface. @@ -23,72 +24,27 @@ public class LogMessageNotificationHandlerImpl private Logger logger = Logger.getLogger(LogMessageNotificationHandlerImpl.class); - private String logType; - - private boolean isEnabled = true; - - /** - * Creates an instance of <tt>LogMessageNotificationHandlerImpl</tt> by - * specifying the log type. - * - * @param logType the type of the log - */ - public LogMessageNotificationHandlerImpl(String logType) - { - this.logType = logType; - } - /** - * Returns the type of the log - * - * @return the type of the log + * {@inheritDoc} */ - public String getLogType() + public String getActionType() { - return logType; + return NotificationAction.ACTION_LOG_MESSAGE; } /** * Logs a message through the sip communicator Logger. * + * @param action the action to act upon * @param message the message coming from the event */ - public void logMessage(String message) + public void logMessage(LogMessageNotificationAction action, String message) { - if (logType.equals(LogMessageNotificationHandler.ERROR_LOG_TYPE)) + if (action.getLogType().equals(ERROR_LOG_TYPE)) logger.error(message); - else if(logType.equals(LogMessageNotificationHandler.INFO_LOG_TYPE)) - if (logger.isInfoEnabled()) - logger.info(message); - else if(logType.equals(LogMessageNotificationHandler.TRACE_LOG_TYPE)) - if (logger.isTraceEnabled()) - logger.trace(message); - } - - /** - * Returns TRUE if this notification action handler is enabled and FALSE - * otherwise. While the notification handler for the log message action type - * is disabled no messages will be logged when the - * <tt>fireNotification</tt> method is called. - * - * @return TRUE if this notification action handler is enabled and FALSE - * otherwise - */ - public boolean isEnabled() - { - return isEnabled; - } - - /** - * Enables or disables this notification handler. While the notification - * handler for the log message action type is disabled no messages will be - * logged when the <tt>fireNotification</tt> method is called. - * - * @param isEnabled TRUE to enable this notification handler, FALSE to - * disable it. - */ - public void setEnabled(boolean isEnabled) - { - this.isEnabled = isEnabled; + else if(action.getLogType().equals(INFO_LOG_TYPE)) + logger.info(message); + else if(action.getLogType().equals(TRACE_LOG_TYPE)) + logger.trace(message); } } |