Example - I want to call my customized logger, and I want to pass the
line number and the name of the function to the logger. I do not mind
hard coding the function name as that would not change, but I would
like not to hand code the line number.
Thanks!
Tony Z
function getStackLine(){
try{
throw new Error("lineNum")
} catch(e){
var line= e.stack
.split(/\n/).filter(function(e){
return e.length;
})[1]
return {
file:line.listBefore(":").listAfter(" "),
line:parseInt(line.listLast(":"))
}
}
}
----------------------------------------------------------
Mark Porter
Myna JavaScript Application Server
Easy web development with server-side JavaScript
http://www.mynajs.org
> --
> You received this message because you are subscribed to the Google Groups "MynaJS-General" group.
> To post to this group, send email to mynajs-...@googlegroups.com.
> To unsubscribe from this group, send email to mynajs-genera...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mynajs-general?hl=en.
>
>
I suppose just specifying the class and method or something would
narrow it down enough as long as the code is concise, which I try to
do anyway.
Thanks!
Tony