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 boolean
m_AddTimestamp
whether to block the flow execution.protected BaseCharset
m_Encoding
the encoding to use.protected DateFormatString
m_Format
the format to use.protected DateFormat
m_Formatter
for generating the timestamp.protected PlaceholderFile
m_OutputFile
the log file.protected TimeZone
m_TimeZone
the 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 String
addTimestampTipText()
Returns the tip text for this property.protected String
check(String msg)
Hook method before attempting to send the message.void
defineOptions()
Adds options to the internal list of options.protected String
doSendNotification(String msg)
Sends the notification.String
encodingTipText()
Returns the tip text for this property.String
formatTipText()
Returns the tip text for this property.boolean
getAddTimestamp()
Returns whether to output a timestamp on separate line using the specified format.protected DateFormatString
getDefaultFormat()
Returns the default format to use.BaseCharset
getEncoding()
Returns the encoding to use.DateFormatString
getFormat()
Returns the format string in use; use single quotes for non-format chars, eg: "yyyyMMdd'T'HHmmss.'csv'".protected DateFormat
getFormatter()
Returns the instance of a date formatter to use.PlaceholderFile
getOutputFile()
Returns the output file.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.TimeZone
getTimeZone()
Returns the time zone in use.String
globalInfo()
Returns a string describing the object.String
outputFileTipText()
Returns the tip text for this property.void
setAddTimestamp(boolean value)
Sets whether to output a timestamp on separate line using the specified format.void
setEncoding(BaseCharset value)
Sets the encoding to use.void
setFormat(DateFormatString value)
Sets the format string to use; use single quotes for non-format chars, eg: "yyyyMMdd'T'HHmmss.'csv'".void
setOutputFile(PlaceholderFile value)
Sets the output file.void
setTimeZone(TimeZone value)
Sets the time zone to use.String
timeZoneTipText()
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:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setOutputFile
public void setOutputFile(PlaceholderFile value)
Sets the output file.- Specified by:
setOutputFile
in interfaceFileWriter
- Parameters:
value
- the file
-
getOutputFile
public PlaceholderFile getOutputFile()
Returns the output file.- Specified by:
getOutputFile
in interfaceFileWriter
- Returns:
- the file
-
outputFileTipText
public String outputFileTipText()
Returns the tip text for this property.- Specified by:
outputFileTipText
in 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:
setEncoding
in 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:
getEncoding
in 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:
encodingTipText
in 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:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in 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:
check
in 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:
doSendNotification
in classAbstractNotification
- Parameters:
msg
- the message to send- Returns:
- null if successfully sent, otherwise error message
-
-