meld.js hello world example

527 views
Skip to first unread message

Leo Cono

unread,
Jan 12, 2015, 8:39:27 AM1/12/15
to cuj...@googlegroups.com
I am new to meld.js.
Where can I find a meld.js hello world example?

Scott Andrews

unread,
Jan 12, 2015, 7:57:42 PM1/12/15
to cuj...@googlegroups.com
There isn't too much more to meld.js than is in the project readme or the cache example in the reference docs. Beyond that it depends on what you're trying to do.

-Scott


On Mon, Jan 12, 2015 at 5:39 AM, Leo Cono <leo...@gmail.com> wrote:
I am new to meld.js.
Where can I find a meld.js hello world example?

--
You received this message because you are subscribed to the Google Groups "cujojs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cujojs+un...@googlegroups.com.
To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.
To view this discussion on the web visit https://groups.google.com/d/msgid/cujojs/ad0f956f-c337-4af4-a0b5-63c19205d61a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Cavalier

unread,
Jan 13, 2015, 8:55:48 AM1/13/15
to cuj...@googlegroups.com
Hi Leo,

Like Scott said, there is a simple example in the readme, and other examples throughout the docs (https://github.com/cujojs/meld/tree/dev/docs).  If you have specific questions about how, why, when to use meld, etc please feel free to post them.

b


On Monday, January 12, 2015 at 7:57:42 PM UTC-5, scothis wrote:
There isn't too much more to meld.js than is in the project readme or the cache example in the reference docs. Beyond that it depends on what you're trying to do.

-Scott

On Mon, Jan 12, 2015 at 5:39 AM, Leo Cono <leo...@gmail.com> wrote:
I am new to meld.js.
Where can I find a meld.js hello world example?

--
You received this message because you are subscribed to the Google Groups "cujojs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cujojs+unsubscribe@googlegroups.com.

Leo Cono

unread,
Jan 13, 2015, 9:09:40 AM1/13/15
to cuj...@googlegroups.com
I am interested in building an AOP Container/Framework.
I would like to build a framework library that javascript applications can call to get automatic logging, tracing, benchmarking of javascript method calls in the application.

For example:
App.js calls
method1
method 2
method 3

Thus by including my framework AOP Container in App.js, this javascript application will automatically
meld method1, method2 and method3 function calls via reflection and
automatic tracing, logging and benchmarking will be done for App.js just by including my
AOP Container Framework.

Is this possible with Meld?

Thanks,
Leo Cono
201-923-9595

Scott Andrews

unread,
Jan 13, 2015, 1:11:23 PM1/13/15
to cuj...@googlegroups.com
It's certainly possible. probes.js is an attempt to advise an application for performance monitoring. The project is now abandonware, but it was fun to create.

-Scott

--
You received this message because you are subscribed to the Google Groups "cujojs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cujojs+un...@googlegroups.com.

To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.

Leo Cono

unread,
Jan 13, 2015, 8:12:33 PM1/13/15
to cuj...@googlegroups.com
Hi Scott, do you have a demo example on how to use probes?
Also are you available for freelance work?
Thanks,
Leo
201-923-9595

--
You received this message because you are subscribed to a topic in the Google Groups "cujojs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cujojs/ReXYqK-y24w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cujojs+un...@googlegroups.com.

To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.

Leo Cono

unread,
Jan 14, 2015, 3:54:52 PM1/14/15
to cuj...@googlegroups.com
Scott - I would like to see a simple example of meld.js where you specify a method name and it will call a function to perform console.log every time the method is called.  and perhaps even when the method is entered and when the method is exited so I can do some benchmarkig.

Suppose we have app.js and it calls framework.js that includes meld.js

you can use var that = this; trick to pass in app.js this into the framework.js

var Test = function() {
    var that = this;
    function testOne() {}
    function testTwo() {}
    function testThree() {}
    function getMethods() {
      for (i in that) {
        alert(i);
      }
    }
    return { getMethods : getMethods }
}();


next using the following technique:
for(var prop in whatever) {
    if(typeof whatever[prop] == 'function') {
        //do something
    }
}

i can find out the name of the app.js method and apply the method name to meld.js api calls.

Do you have a demo that can help me with this?

Thanks,
Leo

Brian Cavalier

unread,
Jan 15, 2015, 2:29:43 PM1/15/15
to cuj...@googlegroups.com
Leo,

Meld supports pointcut "expressions" in the form of regex, or even a function you supply, to be able to apply advice to many methods at once.  There are examples of various ways to do it here:


As for determining the method name, you can get that information from the joinpoint.  The joinpoint represents, roughly, the call site at which meld intercepted a method or function call.  Around advice receives the joinpoint directly as an argument, but other advice types must access it by calling meld.joinpoint().  More info here on accessing the joinpoint:


For a description of what information the joinpoint provides, see here:


Hope that helps.

b

To unsubscribe from this group and stop receiving emails from it, send an email to cujojs+unsubscribe@googlegroups.com.

To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.

--
You received this message because you are subscribed to a topic in the Google Groups "cujojs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cujojs/ReXYqK-y24w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cujojs+unsubscribe@googlegroups.com.

To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.

Leo Cono

unread,
Jan 16, 2015, 8:06:56 AM1/16/15
to cuj...@googlegroups.com
ok so what I understand now is that I do not need to pass in
    var that = this;
into my framework that is utilizing meld.js because meld.js already has JoinPoint that intercepts methods before they are executed.
To me JoinPoint is better than meld.before because with meld.before I need to pass in "this" to perform method name reflection
and for each method name apply the following code:
meld.before(myObject, 'doSomething', function() {
    console.log(arguments.length);


However, it appears that since JoinPoint intercepts method calls before they are executed, I do not have to worry about
passing in "this" and performing method name reflection.

In your documentation you have a good example of meld.before but I do not see an example of JoinPoint.

Do you have an example of JoinPoint intercepting a method call and logging to the console before and after the method is executed?

Thanks,
Leo




On Monday, January 12, 2015 at 8:39:27 AM UTC-5, Leo Cono wrote:

Brian Cavalier

unread,
Jan 21, 2015, 7:15:57 AM1/21/15
to cuj...@googlegroups.com
Leo,

meld.joinpoint doesn't intercept methods.  It returns a joinpoint object that refers to the method that is currently being intercepted.  As such, it is only valid to call meld.joinpoint inside advice functions that you've applied using one or more of the other meld functions, such as meld.before, meld.after, etc.  You may have been thinking of meld.around() which applies Around advice, which is the most powerful type of advice.  It can execute code both before and after the original method, and even prevent the original method from executing if you so desire.

Here's a simple example of using Around advice to log to the console before and after the original method.

var myObject = { doSomething: function(a) { console.log('myObject.doSomething', this, a); } };
meld
.around(myObject, 'doSomething', function(joinpoint) {
    console
.log('logged before myObject.doSomething', this);
   
var result = joinpoint.proceed(); // allow the original method to execute
    console
.log('logged after myObject.doSomething', this);
   
return result;
});


Keep in mind, though, that you should always use the simplest type of advice that gets the job done.  Around is the most powerful, but also the easiest to make a mistake with, and incurs more of a performance penalty than the other types.

In all advice types, meld ensures that `this` always has the same value as it would have had in the original method or function.  So, there no need to do any `var that = this` dance.  See the around example above.

b

Leo Cono

unread,
Jan 21, 2015, 8:26:10 AM1/21/15
to cuj...@googlegroups.com
Brian, I followed your suggestion of using meldaround and it does not seem to work.

I created a simple hello world example to see if meldaround is working and I did not see the desired result.
Please correct my mistake.  Thanks, Leo


this is the application javascript file: app.js

var node_framework = require('./trace.js');

var user = new node_framework.User('Leo');

user.sayHello();

user.doTrace();

user.sayHello();




This is the javascript module file, that app.js calls, called trace.js:

var meld;

meld = require('./meld.js');


var User = function(name){

this.name = name;

};

User.prototype.sayHello = function(){

console.log('hello ' + this.name);

};

function sayMeld() {

console.log('meld function called:');

}

meld.around(User, User.sayHello, sayMeld());

console.log('hello in trace module ' + this.name);

};

exports.User = User;



The following is an output of the Console Window:
hello Leo
meld function called:
hello in trace module Leo
hello Leo


App.js is calling user.sayHello(); 2 times
however the Console output window shows that
meld function called: was printed to the console window only once instead of twice.

Brian, what is wrong with this simple app.js and trace.js example?


Thanks,
Leo




On Monday, January 12, 2015 at 8:39:27 AM UTC-5, Leo Cono wrote:

Edan Schwartz

unread,
Jan 22, 2015, 12:33:56 PM1/22/15
to cuj...@googlegroups.com
Hi Leo,

Pay attention to the signature of the `meld.around` method:

meld.around(Object,'methodName',function(joinPoint) {});

Do you see how that does not match the example in your last post?

Here's how it should look:

meld.around(User.prototype, 'sayHello', function(joinPoint) {
  sayMeld
();
  joinPoint
.proceed();
});

Even better, just use the `meld.before` method:

meld.before(User.prototype, 'sayHello', sayMeld);


Edan

Leo Cono

unread,
Jan 23, 2015, 8:32:42 AM1/23/15
to cuj...@googlegroups.com
Hi Edan and thanks for your reply.

I got it to work with meldaround.

However, when I have a business object in one java script file and trace.js in another java script file it does not work.
Also I will try meldbefore later and let you know the results.

Here is the complete Hello World Meld example that works:

this is the app.js file:
var node_framework = require('./trace-meldaround-user.js');


var user = new node_framework.User('Leo');
var trace = new node_framework.Trace('Hello Meld App');

trace.doTrace();

user.sayHello();

 

this is the  trace-meldaround-user.js file:
var meld, joinPoint, User;


meld = require('./meld.js');
joinPoint = meld.joinpoint;


var User = function(name){
 this.name = name;
 };

 User.prototype.sayHello = function(){
  console.log('hello ' + this.name);
 };

 exports.User = User;


var Trace = function(AppName){
 this.appName = AppName;
 };


 Trace.prototype.doTrace = function(){
 
  function sayMeld(jp, AppName) {  
   console.log('meldaround function called for Application : ' + AppName);

   console.log('JoinPoint Method: ' +  jp.method);
   console.log('JoinPoint Target: ' + jp.target);
   console.log('JoinPoint Args: ' + jp.args.toString());
   console.log('JoinPoint Result: ' + jp.result);
   console.log('JoinPoint Exception: ' + jp.exception);
  }

  var app = this.appName;

  meld.around(User.prototype, 'sayHello', function(joinPoint){
   sayMeld(joinPoint, app);
  
   joinPoint.proceed();
  });
 };

 exports.Trace = Trace;

 
and this is the results in the Console Window:

meldaround function called for Application : Hello Meld App

JoinPoint Method: sayHello

JoinPoint Target: [object Object]

JoinPoint Args:

JoinPoint Result: undefined

JoinPoint Exception: undefined

hello Leo

Thus, YES I am very pleased with this result.  Thank You.


Here is another example that does not work.
I have 3 files: app.js, user.js and trace-meldaround.js
It does not work because the User object is undefined even though I am passing in the User Object into doTrace.
Do you know why I am getting this error?

Here is the complete example in separate files that does not work:

this is the app.js file:
var business_object = require('./user.js');
var node_framework = require('./trace-meldaround.js');
var user = new business_object.User('Leo');
var trace = new node_framework.Trace('Hello Meld App', user);
trace.doTrace();
user.sayHello();

this is the user.js file:

var User = function(name){
 this.name = name;
 };
 User.prototype.sayHello = function(){
  console.log('hello ' + this.name);
 };
 exports.User = User;
 

this is the trace-meldaround.js file:
var meld, joinPoint, User;

meld = require('./meld.js');
joinPoint = meld.joinpoint;
//User = require('./user.js');
var Trace = function(AppName, User){
 this.appName = AppName;
 this.user = User;
 };

 Trace.prototype.doTrace = function(){
 
  function sayMeld(jp, AppName) {  
   console.log('meldaround function called for Application : ' + AppName);
   console.log('JoinPoint Method: ' +  jp.method);
   console.log('JoinPoint Target: ' + jp.target);
   console.log('JoinPoint Args: ' + jp.args.toString());
   console.log('JoinPoint Result: ' + jp.result);
   console.log('JoinPoint Exception: ' + jp.exception);
  }
  var app = this.appName;
  var User = this.user;
  meld.around(User.prototype, 'sayHello', function(joinPoint){
   sayMeld(joinPoint, app);
  
   joinPoint.proceed();
  });
 };
 exports.Trace = Trace;


and this is the result in the Console Window that shows the error:
C:\Users\leo\workspace\node-demo\meld.js:67
     if (typeof target[pointcut] === 'function') {
                      ^
TypeError: Cannot read property 'sayHello' of undefined
    at meld (C:\Users\leo\workspace\node-demo\meld.js:67:23)
    at Function.advice (C:\Users\leo\workspace\node-demo\meld.js:436:12)
    at Trace.doTrace (C:\Users\leo\workspace\node-demo\trace-meldaround.js:29:8)
    at Object.<anonymous> (C:\Users\leo\workspace\node-demo\app-separate-files.js:8:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain [as _onTimeout] (module.js:497:10)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)


Thanks,
Leo

On Monday, January 12, 2015 at 8:39:27 AM UTC-5, Leo Cono wrote:

Scott Andrews

unread,
Jan 23, 2015, 1:34:10 PM1/23/15
to cuj...@googlegroups.com
That exception indicates that meld can't find the sayHello method on the object you passed in. Can you double check what User is in this case? It's suspicious that you commented out the require statement for the user module.

-Scott

--
You received this message because you are subscribed to the Google Groups "cujojs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cujojs+un...@googlegroups.com.

To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.

Brian Cavalier

unread,
Jan 23, 2015, 1:53:01 PM1/23/15
to cuj...@googlegroups.com
Leo,

These two lines seem to be the issue:

var User = this.user;
meld
.around(User.prototype, 'sayHello', function(joinPoint){

From reading the code, it seems this.user is an object *instance*.  So var User = this.user; means that the local variable named User also refers to that same object instance.  Object instances don't have a .prototype property, only constructor functions do.  Hence, User.prototype is undefined, which leads to the TypeError you pasted at the end of your message.  I think you probably intended one of the following (remember that User is an instance in this case):

meld.around(User, 'sayHello', function(joinPoint){

Or

meld.around(User.constructor.prototype, 'sayHello', function(joinPoint){

The first one above will add advice to the specific User instance.  IOW, other instances of the User constructor (the one defined in the user.js module) will not be advised.  The second one, however, traverses to the prototype via the now-standard constructor property (which, in this case, will be the User constructor defined in the user.js module), thus adding advice directly to the prototype.  In that case, all instances created from that constructor would be advised.

Did that make sense?

I do think you've uncovered an interesting case from which meld probably should defend itself.  Internally, it should probably check to see if target is a valid object or function before attempting to reference target[pointcut].

Brian Cavalier

unread,
Jan 23, 2015, 1:55:12 PM1/23/15
to cuj...@googlegroups.com
Leo,

Another possibility is that you may have intended to pass the User constructor into the Trace constructor, rather than passing a user instance.  In that case, the code looks like it would work as well, and would advise the User constructor's prototype, hence all User instances would see the advised behavior.

Leo Cono

unread,
Jan 23, 2015, 5:56:14 PM1/23/15
to cuj...@googlegroups.com
Thanks Brian and Scott for the explanation on User.constructor.prototype it worked.

My next dilemma is the following.  Here is the code to app.js:

var user_object = require('./user.js');
var business_object = require('./business_object.js');

var node_framework = require('./trace-meldaround.js');
var user = new user_object.User('Leo');
var bizObj = new business_object.IT('Manager');

var trace = new node_framework.Trace('Hello Meld App');

trace.doTrace(user);
trace.doTrace(bizObj);

user.sayHello();
bizObj.sayBusinessFunction();

As you can see in this example, I have to manually call doTrace for every object in app.js
and also inside trace-meldaround.js is a hard-coded dependency that I need to have knowledge of method sayHello in order for meldaround to work:

meld.around(User.prototype, 'sayHello', function(joinPoint){
   sayMeld(joinPoint, app);
  
   joinPoint.proceed();
  });


Thus, my question is this, is there a way that trace-meldaround.js can automatically discover objects: user and bizObj that are present in app.js?
Also is there a way that trace-meldaround.js can automatically do a meldaround on all methods of user and bizObj instances without any hard-coding ?

Currently, I am passing in the objects into doTrace.
Do I need to pass in app.js "this" into doTrace?
How can I achieve this app.js reflection/object/method discovery inside trace-meldaround.js?

Thanks,
Leo


--
You received this message because you are subscribed to a topic in the Google Groups "cujojs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cujojs/ReXYqK-y24w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cujojs+un...@googlegroups.com.

To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.

Leo Cono

unread,
Jan 27, 2015, 6:29:06 AM1/27/15
to cuj...@googlegroups.com
I am using node.js and this, as well as, this.global is empty
Anybody know why it is empty?
Here is the code:


var business_object = require('./user.js');

var node_framework = require('./trace-meldaround.js');

var user = new business_object.User('Leo');

var thisObj = this;

var globalObj = this.global;

var methods = [];

for (var method in thisObj) {

if (typeof thisObj[method] == 'function') {

methods.push(method);

}

for (var method in globalObj) {

if (typeof globalObj[method] == 'function') {

methods.push(method);


}

}

Thanks,
Leo

On Monday, January 12, 2015 at 8:39:27 AM UTC-5, Leo Cono wrote:

Brian Cavalier

unread,
Jan 27, 2015, 7:44:10 AM1/27/15
to cuj...@googlegroups.com
Leo,

In node-style modules (which are a subtle variant of commonjs), unscoped `this` refers to the module's exports object.  For example, here is a module:

exports.foo = 'bar';
console
.log(this);

That will log an object { foo: 'bar' }.

So, in your example `this.global` refers to a property named `global`, which doesn't exist, on the module's `exports`.

Brian Cavalier

unread,
Jan 27, 2015, 7:55:31 AM1/27/15
to cuj...@googlegroups.com
Hi Leo,

> Thus, my question is this, is there a way that trace-meldaround.js can automatically discover objects: user and bizObj that are present in app.js?

There is no way to discover free and/or local variable and function names at runtime in JavaScript.  It is possible of course to traverse property graphs of objects or functions (including constructors and their prototypes) to which you already have a reference.

You may be familiar with AspectJ (or similar AOP weaving systems from other platforms), which does a high level of introspection by examining all classes on the classpath.  To achieve something similarly sophisticated in JavaScript, you would need to plug into the module loader.  That's certainly possible, although I've not gone down that road.  Wire.js (https://github.com/cujojs/wire) provides a limited form of AOP weaving for components it creates.  It can do that because it has access to all objects that it creates.  Personally, I think doing weaving at the loader level would be a very interesting project.

> Also is there a way that trace-meldaround.js can automatically do a meldaround on all methods of user and bizObj instances without any hard-coding ?

There are several options, such as regular expressions and functions, that you can use instead of hardcoding method names.  Please read the meld docs section on method name matching: https://github.com/cujojs/meld/blob/dev/docs/reference.md#matching-method-names

Brian

To unsubscribe from this group and all its topics, send an email to cujojs+unsubscribe@googlegroups.com.

To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.

Leo Cono

unread,
Jan 27, 2015, 8:43:02 AM1/27/15
to cuj...@googlegroups.com
Brian, you mentioned that it is possible of course to traverse property graphs of objects or functions (including constructors and their prototypes) to which you already have a reference.

In the following code, what do I need to do to traverse property graphs of objects or functions?


var business_object = require('./user.js');

var node_framework = require('./trace-meldaround.js');

var user = new business_object.User('Leo');

var thisObj = this;

var globalObj = this.global;

var methods = [];

for (var method in thisObj) {

if (typeof thisObj[method] == 'function') {

methods.push(method);

}

for (var method in globalObj) {

if (typeof globalObj[method] == 'function') {

methods.push(method);

}

}

Thanks,
Leo

On Monday, January 12, 2015 at 8:39:27 AM UTC-5, Leo Cono wrote:

Brian Cavalier

unread,
Jan 27, 2015, 12:46:34 PM1/27/15
to cuj...@googlegroups.com
Leo,

To traverse properties in JS, you have to start with an object or function (or a collection of them) in your hand.  Then you can use property iteration, via for-in (as you did in your example) or Object.keys.  Applying recursion to that will allow you to traverse trees of properties.

It's an extremely tricky proposition, though, since you'd end up iterating over (potentially) large numbers of properties that are likely not of any interest (numbers, strings, methods on objects you don't really care about, etc. etc).  So, you'd probably need to formulate some sort of query/filter strategy.  Also, JavaScript applications tend to be all over the map in terms of how they are architected, so doing this kind of large scale AOP in the general case will probably be very tough.  If you can limit the scale and make some assumptions, perhaps about your particular application(s), it'll be easier.

Leo Cono

unread,
Feb 11, 2015, 4:29:27 PM2/11/15
to cuj...@googlegroups.com
NodeClipse Eclipse plug-in for Node.js does not work with the embedded V8 Debugger.
Instead I accessed the JavaScript Application module exports to do reflection with Node.js apps since "this" object is empty.
Here is the code:

app.js code:

var User = function(name){
   
this.name = name;
    };

    User.prototype.sayHello = function(){
        console.log('hello ' + this.name);
    };

    User.prototype.sayGoodBye = function(){
        console.log('Good Bye ' + this.name);
    };

    exports.User = User;

 

trace-meldaround.js Code:
var meld, joinPoint;


meld = require('./meld.js');
joinPoint = meld.joinpoint;

var log4js = require('./node_framework/log4js-node-master/lib/log4js'); // include log4js

log4js.configure({ // configure to use all types in different files.
    appenders: [
        {   type: 'file',
            filename: '../logs/error.log', // specify the path where u want logs folder error.log
            category: 'error',
            maxLogSize: 20480,
            backups: 10
        },
        {   type: 'file',
            filename: '../logs/info.log', // specify the path where u want logs folder info.log
            category: 'info',
            maxLogSize: 20480,
            backups: 10
        },
        {   type: 'file',
            filename: '../logs/debug.log', // specify the path where u want logs folder debug.log
            category: 'debug',
            maxLogSize: 20480,
            backups: 10
        }
    ]
});

var loggerinfo = log4js.getLogger('info'); // initialize the var to use.
var loggererror = log4js.getLogger('error'); // initialize the var to use.
var loggerdebug = log4js.getLogger('debug'); // initialize the var to use.


var Trace = function(AppName){
    this.appName = AppName;
    };


    Trace.prototype.doTrace = function(){
   
        function sayMeld(jp) {           
            console.log('meldaround function called for Application : ' + Trace.constructor.AppName);


            console.log('JoinPoint Method: ' +  jp.method);
            console.log('JoinPoint Target: ' + jp.target);
            console.log('JoinPoint Args: ' + jp.args.toString());
            console.log('JoinPoint Result: ' + jp.result);
            console.log('JoinPoint Exception: ' + jp.exception);
            loggerinfo.info('Calling Method: ' + jp.method);
            loggererror.info('This is Error Logger');
            loggerdebug.info('JoinPoint Method: ' +  jp.method);
            loggerdebug.info('JoinPoint Target: ' + jp.target);
            loggerdebug.info('JoinPoint Args: ' + jp.args.toString());
            loggerdebug.info('JoinPoint Result: ' + jp.result);
            loggerdebug.info('JoinPoint Exception: ' + jp.exception);           
        }
       
       
        var appObjects = module.parent.children;       
        var methods = [];
        var objects = [];

        for (var i=0; i<appObjects.length;i++){   
            if (typeof appObjects[i] == 'object'){
                    objects.push(appObjects[i]);
                   
                    var funcObj = appObjects[i].exports;
                    if (typeof funcObj == 'object')
                    {
                        for (var key in funcObj){
                            var k =0;
                            var prototypeObj = funcObj[key].prototype;
                            methods[i] = [];
                            for (var proto in prototypeObj){                                                                                                
                                 methods[i][k] = proto;
                                 k++;
                            }                                                                               
                        }
                    }                   
                }
        }

       
        for (var j=0; j<objects.length; j++){
            var ObjectName;
            for (var key2 in objects[j].exports){               
                ObjectName = key2;
                console.log(objects[j].exports[ObjectName].prototype);
               
                for (var n=0; n<methods[j].length; n++){
                    if (ObjectName != 'Trace'){
                    meld.around(objects[j].exports[ObjectName].prototype, methods[j][n], function(joinPoint){
                        sayMeld(joinPoint);

                       
                        joinPoint.proceed();
                    });   
                    }
                }

            }                       
    }
       
    };

    exports.Trace = Trace;

On Monday, January 12, 2015 at 8:39:27 AM UTC-5, Leo Cono wrote:
Reply all
Reply to author
Forward
0 new messages