Re: creating logs of all actions performed
Re: creating logs of all actions performed
- Subject: Re: creating logs of all actions performed
- From: Bob Studer <email@hidden>
- Date: Wed, 29 Sep 2004 23:16:36 -0700
On Sep 29, 2004, at 2:59 AM, Jasneet Kaur wrote:
<x-tad-bigger>I need to create logs of all the actions being performed as an apple script is run, that is, not just on error, but in all cases. The log should be made of each and everything that the script does.</x-tad-bigger>
This is what I do:
I add the following handler to my script. I change the appName property to the suitable value. I can toggle logging on and off with the verbose property. You could even set up a severity level with the verbose property if you wanted to.
-- Handler to log to the console
property appName : "applicationName"
property verbose : true
on log (message)
if verbose then
do shell script "echo `date`' " & appName & ": " & message & "' > /dev/console"
end if
end log
When you call:
log ("Message goes here")
The date will be prepended to the message along with the application name and written to the end of the console log. (You don't need to use the '>>' for this to work properly.) You can then use the filtering capability of Console.app to only show the messages from your script.
-Bob
PGP: 0x5A969850
---------------------
Clay's Conclusion:
Creativity is great, but plagiarism is faster.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden