Package adams.flow.sink.sendnotification
Class LogFile
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.sink.sendnotification.AbstractNotification
-
- adams.flow.sink.sendnotification.LogFile
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,EncodingSupporter,FileWriter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,FlowContextHandler,Serializable
public class LogFile extends AbstractNotification implements FileWriter, EncodingSupporter
Outputs the message to a log file. Optional timestamp output on a separate line is available as well.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_AddTimestampwhether to block the flow execution.protected BaseCharsetm_Encodingthe encoding to use.protected DateFormatStringm_Formatthe format to use.protected DateFormatm_Formatterfor generating the timestamp.protected PlaceholderFilem_OutputFilethe log file.protected TimeZonem_TimeZonethe timezone to use.-
Fields inherited from class adams.flow.sink.sendnotification.AbstractNotification
m_FlowContext
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description LogFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddTimestampTipText()Returns the tip text for this property.protected Stringcheck(String msg)Hook method before attempting to send the message.voiddefineOptions()Adds options to the internal list of options.protected StringdoSendNotification(String msg)Sends the notification.StringencodingTipText()Returns the tip text for this property.StringformatTipText()Returns the tip text for this property.booleangetAddTimestamp()Returns whether to output a timestamp on separate line using the specified format.protected DateFormatStringgetDefaultFormat()Returns the default format to use.BaseCharsetgetEncoding()Returns the encoding to use.DateFormatStringgetFormat()Returns the format string in use; use single quotes for non-format chars, eg: "yyyyMMdd'T'HHmmss.'protected DateFormatgetFormatter()Returns the instance of a date formatter to use.PlaceholderFilegetOutputFile()Returns the output file.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.TimeZonegetTimeZone()Returns the time zone in use.StringglobalInfo()Returns a string describing the object.StringoutputFileTipText()Returns the tip text for this property.voidsetAddTimestamp(boolean value)Sets whether to output a timestamp on separate line using the specified format.voidsetEncoding(BaseCharset value)Sets the encoding to use.voidsetFormat(DateFormatString value)Sets the format string to use; use single quotes for non-format chars, eg: "yyyyMMdd'T'HHmmss.'voidsetOutputFile(PlaceholderFile value)Sets the output file.voidsetTimeZone(TimeZone value)Sets the time zone to use.StringtimeZoneTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.sink.sendnotification.AbstractNotification
getFlowContext, sendNotification, setFlowContext
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_OutputFile
protected PlaceholderFile m_OutputFile
the log file.
-
m_Encoding
protected BaseCharset m_Encoding
the encoding to use.
-
m_AddTimestamp
protected boolean m_AddTimestamp
whether to block the flow execution.
-
m_Format
protected DateFormatString m_Format
the format to use.
-
m_TimeZone
protected TimeZone m_TimeZone
the timezone to use.
-
m_Formatter
protected transient DateFormat m_Formatter
for generating the timestamp.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setOutputFile
public void setOutputFile(PlaceholderFile value)
Sets the output file.- Specified by:
setOutputFilein interfaceFileWriter- Parameters:
value- the file
-
getOutputFile
public PlaceholderFile getOutputFile()
Returns the output file.- Specified by:
getOutputFilein interfaceFileWriter- Returns:
- the file
-
outputFileTipText
public String outputFileTipText()
Returns the tip text for this property.- Specified by:
outputFileTipTextin interfaceFileWriter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setEncoding
public void setEncoding(BaseCharset value)
Sets the encoding to use.- Specified by:
setEncodingin interfaceEncodingSupporter- Parameters:
value- the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
-
getEncoding
public BaseCharset getEncoding()
Returns the encoding to use.- Specified by:
getEncodingin interfaceEncodingSupporter- Returns:
- the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
-
encodingTipText
public String encodingTipText()
Returns the tip text for this property.- Specified by:
encodingTipTextin interfaceEncodingSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAddTimestamp
public void setAddTimestamp(boolean value)
Sets whether to output a timestamp on separate line using the specified format.- Parameters:
value- true if to output timestamp
-
getAddTimestamp
public boolean getAddTimestamp()
Returns whether to output a timestamp on separate line using the specified format.- Returns:
- true if to output timestamp
-
addTimestampTipText
public String addTimestampTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getFormatter
protected DateFormat getFormatter()
Returns the instance of a date formatter to use.- Returns:
- the formatter object
-
getDefaultFormat
protected DateFormatString getDefaultFormat()
Returns the default format to use.- Returns:
- the format
-
setFormat
public void setFormat(DateFormatString value)
Sets the format string to use; use single quotes for non-format chars, eg: "yyyyMMdd'T'HHmmss.'csv'".- Parameters:
value- the format
-
getFormat
public DateFormatString getFormat()
Returns the format string in use; use single quotes for non-format chars, eg: "yyyyMMdd'T'HHmmss.'csv'".- Returns:
- the format
-
formatTipText
public String formatTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTimeZone
public void setTimeZone(TimeZone value)
Sets the time zone to use.- Parameters:
value- the time zone
-
getTimeZone
public TimeZone getTimeZone()
Returns the time zone in use.- Returns:
- the time zone
-
timeZoneTipText
public String timeZoneTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractNotification- Returns:
- null if no info available, otherwise short string
-
check
protected String check(String msg)
Hook method before attempting to send the message.- Overrides:
checkin classAbstractNotification- Parameters:
msg- the message to send- Returns:
- null if successful, otherwise error message
-
doSendNotification
protected String doSendNotification(String msg)
Sends the notification.- Specified by:
doSendNotificationin classAbstractNotification- Parameters:
msg- the message to send- Returns:
- null if successfully sent, otherwise error message
-
-