LOG_MESSAGE

The LOG_MESSAGE command writes a string to the status window and any active log file. You can use the SET_LOG_FILE command to set the log file to save message to. The USER_FILENAME parameter of that command allows you to have LOG_MESSAGE text written to a different file than default script messages. You can include variables in the command string if you want to log their values. Everything on the line after the LOG_MESSAGE will be written. For example if you have a variable named WATER_LEVEL_FT, you could log its value and a timestamp at the front as follows:

LOG_MESSAGE %TIMESTAMP%: The current value of WATER_LEVEL_FT is %WATER_LEVEL_FT%

If you would like to log messages to the command line (if running a script passed on the command line), make sure to include LOG_TO_COMMAND_PROMPT=YES in the GLOBAL_MAPPER_SCRIPT header line at the start of the script.

Other built-in variables (see DEFINE_VAR) allow you to log the elapsed time (in seconds) for a script. For example you can log the time for an import and export and total script time using the following:

GLOBAL_MAPPER_SCRIPT VERSION=1.00
LOG_MESSAGE Script <%SCRIPT_FILENAME%> started at %DATE% %TIME%
IMPORT FILENAME="test.tif"
LOG_MESSAGE Import took %TIME_SINCE_LAST_LOG%
EXPORT_RASTER TYPE=GEOTIFF FILENAME="output.tif"
LOG_MESSAGE Export took %TIME_SINCE_LAST_LOG%
LOG_MESSAGE Total Script Run Time: %TIME_SINCE_START%