fmeobjects.FMELogFile
|
This method is deprecated as of FME 2020.1. |
This routine sets the allow duplicate messages status of the logfile. |
|
This routine gets the allow duplicate messages status of the logfile. |
|
Get the name of the file that is currently being used to log messages. |
|
Retrieve any held messages and clear the held messages buffer. |
|
|
This method returns the message mapped from 'messageNumber' in FME_HOME/messages/fmemessages.fms. |
Get the 'silent' status of the logfile. |
|
|
Inform FME whether or not log messages should be held. |
|
Log an exception to the logfile. |
|
Log a feature to the logfile. |
|
Log a message to the log file. |
|
Log a simple string to the log file. |
Return the total number of features logged. |
|
|
Provide FME with a callback function that will be called whenever a message is logged. |
|
If the filename is different from the current file, then the current file is closed, and the new one is opened. |
|
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
.
- 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:
- getFileName()
Get the name of the file that is currently being used to log messages.
- Return type:
- 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:
- Return type:
- Returns:
The mapped message with %s patterns replaced.
- Raises:
FMEException – An exception is raised if a message is not successfully retrieved.
- 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 ifholdMessages
is set toFalse
.
- logException(exception, severity)
Log an exception to the logfile.
- Parameters:
exception (Exception) – The exception to log.
severity (int) –
(Optional) The message level. Default value is
FME_INFORM
.Must be one of
FME_INFORM
,FME_WARN
,FME_ERROR
,FME_FATAL
,FME_STATISTIC
, orFME_STATUSREPORT
.
- Return type:
None
- logFeature(feature, severity, maxCoords)
Log a feature to the logfile.
- Parameters:
feature (FMEFeature) – The feature is not modified.
severity (int) –
(Optional) The message level. Default value is
FME_INFORM
.Must be one of
FME_INFORM
,FME_WARN
,FME_ERROR
,FME_FATAL
,FME_STATISTIC
, orFME_STATUSREPORT
.maxCoords (int) – (Optional) Default value: 20. Control how many coordinates to output. A value of -1 means all coordinates will be output.
- Return type:
None
- logMessage(messageNumber, parameters, severity)
Log a message to the log file.
- Parameters:
messageNumber (int) – This is the message index, which is stored in a file in FME’s ‘messages’ directory.
parameters (list[str]) – Supply the values for the fill-in parameters (0, 1, 2, …) of the message.
severity (int) –
(Optional) The message level. Default value is
FME_INFORM
.Must be one of
FME_INFORM
,FME_WARN
,FME_ERROR
,FME_FATAL
,FME_STATISTIC
,FME_STATUSREPORT
, orFME_DEBUGMSG
.
- Return type:
None
- logMessageString(message, severity)
Log a simple string to the log file.
- Parameters:
message (str) – This is the message string.
severity (int) –
(Optional) The message level. Default value is
FME_INFORM
.Must be one of
FME_INFORM
,FME_WARN
,FME_ERROR
,FME_FATAL
,FME_STATISTIC
,FME_STATUSREPORT
, orFME_DEBUGMSG
.
- Return type:
None
- numFeaturesLogged()
Return the total number of features logged.
- Return type:
- 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 withNone
as the filename parameter, then messages will only be sent to the callback.The callback function must take two arguments: An
int
severity, and astr
message.Call
setCallBack`(:py:obj:`None
) to unset a previously-set callback function. This must be called before any previously passed-in callable object falls out of scope.- 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:
- Raises:
FMEException – An exception is raised if there was a problem.
- Return type:
None