write a timestamped message to the log.
write log (message to log)
none will write to the log file but will not display in the log window
background color (html color string) optional. If included the background of the line will be colored this color. Sometimes easier to see a specific message with a custom colored background. (added in v9.3.7)
In addition to the program provided colors listed above if you pass a string containing an RGB or web color that will be used to color the text line in the window and the log line in the file if you are saving the log file as an RTF file.
monospaced adding “with monospaced” will write to the log in a monospaced font easier to line up columns if you’re debugging something interesting.
to if you specify a file reference here the log line will also be appended to the file specified. Use this to create special logs of just the info you’re interested in or write specific info to different places.
always showing if you include “with always showing” it will show in all log windows regardless of the display or filter settings.
filter (string) optional. If included then a filter option for the Log Window will be available to filter the log based on this text. Good for quickly showing just exactly the log lines you’re interested in. (added in v9.3.7)
write log "your mother was a hamster" write log "and your father..." color green write log “this will be orange!” color “FF7722” write log “this is monospaced for debugging” with monospaced set myFile to ((path to desktop folder) as text) & “mySpecialLog.txt” write log “this is my special log file” to myFile write log “this will be filterable” filter “my filter"
when writing to a separate log file it will be up to you to manage and roll these files as appropriate and make sure you’re not writing so much that you fill your hard drive and cause other problems. No rolling or file management is performed on special files at all.
version 9.1 added support for the “always showing” parameter
version 9.3.7 added support for the “filter” parameter
version 9.3.7 added support for the “background color” parameter