Ha, Thanks. I will get the hang of JavaScript pretty soon I promise! :-)I am using Myna.log inside of my logging function. I basically wanted to wrap some functions around Myna logging to make it a little more like apache logger.For example, you can use if(log.isInfoEnabled()) log.log("myMessage");Then inside of log.log, I am using Myna.Log.I have info, debug, none right now. If you wrap your logging with those statements, then you can control the logging level app wide with a setting. Just seems more efficient and makes for easier trouble shooting down the road.Tony Z
On Tue, Oct 12, 2010 at 7:29 PM, Mark Porter <ma...@porterpeople.com> wrote:The problem is using "var" inside of onRequestStart. That binds to the function scope. You want to either leave it un-var'd or explicitly bind it to the global scope: $server.globalScope.log = $application...
On an unrelated note, why are you not using Myna.log() for logging?
--> --On Oct 12, 2010 3:26 PM, "Tony Zakula" <tonyz...@gmail.com> wrote:
> If you have the following in application.sjs
>
> onApplicationStart:function(){ // run if application cache has expired
>
> $application.set("appEngine",Myna.include($application.directory+"appEngine/appEngine.sjs",{}));
>
> $application.set("appLog",Myna.include($application.directory+"appEngine/appLogging.sjs",{}));
> },
> onRequestStart:function(){ // run directly before requested file
> var appEngine = $application.get("appEngine");
> var log = $application.get("appLog");
> $req.handled = appEngine.handleRequest();
> },
>
> Should you be able to call log.mymethod() from inside an appEngine function?
> I keep getting an undefined error.
>
> Thanks,
>
> Tony
>
> 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.
>
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.
Well, since you want to handle every requests that comes in, that is really a "server" operation rather than an application operation, so $server is the appropriate scope.
Actually I would recommend just including the files in the onRequestStart. Myna will cache the script , so there should not be any I/O involved, and since parsing is very fast, it adds a negligible amount of time to each request. It also allows each request to have it's own copy so there are no threading issues. Unless you intend to maintain state inside of the object, then there is no need to make it a singleton.