OK, Here’s what I’m trying now. Is this the right way to implement the logs? Also, since I’m using the same name for the log in each call to logit, is the log file being overwritten or appended to?
to logit(log_string, log_file)
do shell script ¬
"echo `date '+%Y-%m-%d %T: '`\"" & log_string & ¬
"\" >> $HOME/Library/Logs/" & log_file & ".log"
end logit
on directionality(cpInfo)
set outputList to {}
set i to 1
repeat with CP in cpInfo
set eigenvalues to eigenvalues of CP
set eigenvalues to sortlist (eigenvalues)
try
set theta to (atan ((abs ((item 3 of eigenvalues) / (item 2 of eigenvalues))) ^ (1 / 2)))
on error
logit("theta", "directionality")
display dialog "theta" & i
end try
try
set phi to (atan ((abs ((item 3 of eigenvalues) / (item 1 of eigenvalues))) ^ (1 / 2)))
on error
logit("phi", "directionality")
display dialog "phi" & i
end try
try
set end of outputList to CP & {theta:theta, phi:phi}
on error
logit("set list", "directionality")
display dialog "set list" & i
end try
set i to i + 1
end repeat
return outputList
end directionality
logit("run handler", "directionality")
set cpInfo to directionality(*big list of records*)
logit("finish handler", "directionality")
return cpInfo