Package adams.gui.scripting
Class ScriptingLogger
- java.lang.Object
-
- adams.gui.scripting.ScriptingLogger
-
public class ScriptingLogger extends Object
A class that logs all scripting commands.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILENAME
the name of the props file.protected PlaceholderFile
m_LogFile
the file to log the commands to.protected String
m_LogFormat
the logging format.protected Properties
m_Properties
the properties.protected HashSet<ScriptingListener>
m_ScriptingListeners
the listeners.protected static ScriptingLogger
m_Singleton
the singleton.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addScriptingListener(ScriptingListener l)
Adds the given listener to its internal list of listeners.static ScriptingLogger
getSingleton()
Returns the singleton instance of the logger.void
log(Object source, ScriptingCommand cmd, boolean success)
Logs the given command.void
log(Object source, ScriptingCommand cmd, boolean success, String error)
Logs the given command.protected void
notifyScriptingListeners(ScriptingEvent e)
Notifies all the listeners about the specified event.void
removeScriptingListener(ScriptingListener l)
Removes the given listener from its internal list of listeners.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the name of the props file.- See Also:
- Constant Field Values
-
m_Properties
protected Properties m_Properties
the properties.
-
m_LogFile
protected PlaceholderFile m_LogFile
the file to log the commands to.
-
m_LogFormat
protected String m_LogFormat
the logging format.
-
m_ScriptingListeners
protected HashSet<ScriptingListener> m_ScriptingListeners
the listeners.
-
m_Singleton
protected static ScriptingLogger m_Singleton
the singleton.
-
-
Method Detail
-
log
public void log(Object source, ScriptingCommand cmd, boolean success)
Logs the given command.- Parameters:
source
- the source that logged this commandcmd
- the command that was runsuccess
- whether the command was successful
-
log
public void log(Object source, ScriptingCommand cmd, boolean success, String error)
Logs the given command.- Parameters:
source
- the source that logged this commandcmd
- the command that was runsuccess
- whether the command was successfulerror
- an optional error message, null if not available
-
addScriptingListener
public void addScriptingListener(ScriptingListener l)
Adds the given listener to its internal list of listeners.- Parameters:
l
- the listener to add
-
removeScriptingListener
public void removeScriptingListener(ScriptingListener l)
Removes the given listener from its internal list of listeners.- Parameters:
l
- the listener to remove
-
notifyScriptingListeners
protected void notifyScriptingListeners(ScriptingEvent e)
Notifies all the listeners about the specified event.- Parameters:
e
- the event
-
getSingleton
public static ScriptingLogger getSingleton()
Returns the singleton instance of the logger.- Returns:
- the logger instance
-
-