fmeobjects.FMELogFile

Inheritance diagram of fmeobjects.FMELogFile

FMELogFile.activityMessage(message)

This method is deprecated as of FME 2020.1.

FMELogFile.allowDuplicateMessages(...)

This routine sets the allow duplicate messages status of the logfile.

FMELogFile.getAllowDuplicateMessages()

This routine gets the allow duplicate messages status of the logfile.

FMELogFile.getFileName()

Get the name of the file that is currently being used to log messages.

FMELogFile.getHeldMessages()

Retrieve any held messages and clear the held messages buffer.

FMELogFile.getMessage(messageNumber, ...)

This method returns the message mapped from 'messageNumber' in FME_HOME/messages/fmemessages.fms.

FMELogFile.getSilent()

Get the 'silent' status of the logfile.

FMELogFile.holdMessages(holdMessages)

Inform FME whether or not log messages should be held.

FMELogFile.logException(exception, severity)

Log an exception to the logfile.

FMELogFile.logFeature(feature, severity, ...)

Log a feature to the logfile.

FMELogFile.logMessage(messageNumber, ...)

Log a message to the log file.

FMELogFile.logMessageString(message, severity)

Log a simple string to the log file.

FMELogFile.numFeaturesLogged()

Return the total number of features logged.

FMELogFile.setCallBack(function)

Provide FME with a callback function that will be called whenever a message is logged.

FMELogFile.setFileName(fileName, append)

If the filename is different from the current file, then the current file is closed, and the new one is opened.

FMELogFile.silent(silent)

Set the 'silent' status of the logfile.

class FMELogFile

FME Log File Class

init()

Create an instance of a LogFile object.

__init__(*args, **kwargs)
activityMessage(message)

This method is deprecated as of FME 2020.1. Please use logMessageString(message, FME_STATUSREPORT) instead.

Provide an activity feedback message to command line users. Use this message to output any kind of dots or numbers that should be sent to standard output when NOT logging to standard output. Use this function in place of printing to standard output directly. To enable this functionality, the session object must be initialized with the LOG_ENABLE_STDOUT directive set to ‘yes’.

Parameters:

message (str) – The feedback message to provide to users.

Return type:

None

allowDuplicateMessages(allowDuplicateMessages)

This routine sets the allow duplicate messages status of the logfile. If in duplicate message mode subsequent messages with the same text are logged, otherwise only the first message is logged and the duplicates are counted and a count is logged as the next line instead once a different message is logged. Default is False.

Parameters:

allowDuplicateMessages (bool) – When True, duplicate messages are not hidden in the log. Otherwise if False, log hiding of duplicate messages is enabled.

Return type:

None

getAllowDuplicateMessages()

This routine gets the allow duplicate messages status of the logfile. If in duplicate message mode subsequent messages with the same text are logged, otherwise only the first message is logged and the duplicates are counted and a count is logged as the next line instead once a different message is logged. Default is False.

Return type:

bool

getFileName()

Get the name of the file that is currently being used to log messages.

Return type:

str

getHeldMessages()

Retrieve any held messages and clear the held messages buffer.

Return type:

bool

getMessage(messageNumber, messageParameters)

This method returns the message mapped from ‘messageNumber’ in FME_HOME/messages/fmemessages.fms. The mapped message has all its %s replaced by the value in ‘messageParameters’ indexed at s, where s is an integer >= 0.

Parameters:
  • messageNumber (int) – The index of the message in FME’s ‘messages’ location.

  • messageParameters (list[str]) – The values used to replace the %s patterns in the returned message, where s is an integer >= 0.

Return type:

str

Returns:

The mapped message with %s patterns replaced.

Raises:

FMEException – An exception is raised if a message is not successfully retrieved.

getSilent()

Get the ‘silent’ status of the logfile.

Return type:

bool

holdMessages(holdMessages)

Inform FME whether or not log messages should be held. If set to True, then any log messages will be stored in an internal memory buffer for later retrieval, and no messages will be written to the log file, or sent to the callback.

Held messages are retained until they are retrieved with getHeldMessages, even if holdMessages is set to False.

Parameters:

holdMessages (bool) – If set to True, then any log messages will be stored in an internal memory buffer for later retrieval, and no messages will be written to the log file, or sent to the callback.

Return type:

None

logException(exception, severity)

Log an exception to the logfile.

Parameters:
Return type:

None

logFeature(feature, severity, maxCoords)

Log a feature to the logfile.

Parameters:
Return type:

None

logMessage(messageNumber, parameters, severity)

Log a message to the log file.

Parameters:
Return type:

None

logMessageString(message, severity)

Log a simple string to the log file.

Parameters:
Return type:

None

numFeaturesLogged()

Return the total number of features logged.

Return type:

int

Returns:

The total number of features logged.

setCallBack(function)

Provide FME with a callback function that will be called whenever a message is logged. By default, messages will be logged to both the callback function and the Log file. If setFileName is called with None as the filename parameter, then messages will only be sent to the callback.

The callback function must take two arguments: An int severity, and a str message.

Parameters:

function (Callable) – The function to provide FME for use as a callback function.

Return type:

None

setFileName(fileName, append)

If the filename is different from the current file, then the current file is closed, and the new one is opened.

Parameters:
  • fileName (str) – The file name to set.

  • append (bool) – Append new messages to the file if True. Clear the file before any new log messages are added if False.

Raises:

FMEException – An exception is raised if there was a problem.

Return type:

None

silent(silent)

Set the ‘silent’ status of the logfile. When in ‘silent’ mode, nothing is logged.

Parameters:

silent (bool) – When True, ‘silent’ mode is enabled and nothing is logged. Otherwise if False, logging is enabled.

Return type:

None