Write Log

write a timestamped message to the log.

Usage:

write log (message to log)

Optional Parameters:

color (black/blue/green/red/none)
none will write to the log file but will not display in the log window

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.

Examples:

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 fileto myFile

NOTE

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.

History:

version 9.1 added support for the “always showing” parameter

dictionary/human/writelog.txt · Last modified: 2017/02/23 12:40 by James Sentman
CC Attribution-No Derivative Works 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0