Package adams.data.conversion
Class LogEntryToString
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<AbstractConversion>,SizeOfHandler,Stoppable,Conversion,ConversionToString,Serializable
public class LogEntryToString extends AbstractConversionToString
Turns the log entry into a string.
Available placeholders:
- {DBID}
- {HOST}
- {IP}
- {TYPE}
- {GENERATION} (date, format: YYYY-MM-DD hh:mm:ss.SSS)
- {SOURCE}
- {STATUS}
- {MESSAGE}
Using a placeholder of format {MESSAGE.PROP} you can access the particular property PROP of the message itself.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-format <adams.core.base.BaseText> (property: format) The format to use for the log entry. default: Host: {HOST}\\nIP: {IP}\\nType: {TYPE}\\nGeneration: {GENERATION}\\nSource: {SOURCE}\\nStatus: {STATUS}\\nMessage:\\n{MESSAGE}\\n- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DateFormatm_DateFormatfor formatting the date.protected BaseTextm_Formatthe format string.static StringPH_DBIDstatic StringPH_GENERATIONstatic StringPH_HOSTstatic StringPH_IPstatic StringPH_MESSAGEstatic StringPH_MESSAGE_PROPERTY_PREFIXstatic StringPH_SOURCEstatic StringPH_STATUSstatic StringPH_TYPE-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
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 LogEntryToString()Default constructor.LogEntryToString(BaseText format)Initializes the conversion with the specified format.LogEntryToString(String format)Initializes the conversion with the specified format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Classaccepts()Returns the class that is accepted as input.voiddefineOptions()Adds options to the internal list of options.protected ObjectdoConvert()Performs the actual conversion.StringformatTipText()Returns the tip text for this property.BaseTextgetFormat()Returns the format for the log entry.StringglobalInfo()Returns a string describing the object.protected voidreset()Resets the scheme.voidsetFormat(BaseText value)Sets the format for the log entry.-
Methods inherited from class adams.data.conversion.AbstractConversionToString
generates
-
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, getQuickInfo, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, toCommandLine, toString
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
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.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.data.conversion.Conversion
convert, getInput, getInput, getOutput, getOutput, getOwner, setInput, setOwner
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.QuickInfoSupporter
getQuickInfo
-
Methods inherited from interface adams.core.Stoppable
stopExecution
-
-
-
-
Field Detail
-
PH_DBID
public static final String PH_DBID
- See Also:
- Constant Field Values
-
PH_HOST
public static final String PH_HOST
- See Also:
- Constant Field Values
-
PH_IP
public static final String PH_IP
- See Also:
- Constant Field Values
-
PH_TYPE
public static final String PH_TYPE
- See Also:
- Constant Field Values
-
PH_GENERATION
public static final String PH_GENERATION
- See Also:
- Constant Field Values
-
PH_SOURCE
public static final String PH_SOURCE
- See Also:
- Constant Field Values
-
PH_STATUS
public static final String PH_STATUS
- See Also:
- Constant Field Values
-
PH_MESSAGE
public static final String PH_MESSAGE
- See Also:
- Constant Field Values
-
PH_MESSAGE_PROPERTY_PREFIX
public static final String PH_MESSAGE_PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
m_Format
protected BaseText m_Format
the format string.
-
m_DateFormat
protected transient DateFormat m_DateFormat
for formatting the date.
-
-
Constructor Detail
-
LogEntryToString
public LogEntryToString()
Default constructor.
-
LogEntryToString
public LogEntryToString(String format)
Initializes the conversion with the specified format.- Parameters:
format- the format to use
-
LogEntryToString
public LogEntryToString(BaseText format)
Initializes the conversion with the specified format.- Parameters:
format- the format to use
-
-
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
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin classAbstractConversion
-
setFormat
public void setFormat(BaseText value)
Sets the format for the log entry.- Parameters:
value- the format
-
getFormat
public BaseText getFormat()
Returns the format for the log entry.- 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.
-
accepts
public Class accepts()
Returns the class that is accepted as input.- Specified by:
acceptsin interfaceConversion- Specified by:
acceptsin classAbstractConversion- Returns:
- the class
-
doConvert
protected Object doConvert() throws Exception
Performs the actual conversion.- Specified by:
doConvertin classAbstractConversion- Returns:
- the converted data
- Throws:
Exception- if something goes wrong with the conversion
-
-