Can I get the name of the currently executing Meteor method (from within same)? This would be handy for logging.
I inspected this
inside a Meteor method. It is an instance of MethodInvocation
, and doesn't appear to have anything useful for figuring out the method name.
Seems like it would be easy enough to add the method name to MethodInvocation
and callers, but I'm not sure if the maintainers would accept a patch that added a name
field to every MethodInvocation
instance.
Crossposted here.
It's easy with Meteor 1.10.1
You can just use
this.name
e.g
new ValidatedMethod({
name: "pod.create",
validate: new SimpleSchema({
stuff: {
type: String,
}
}).validator(),
run(pData) {
console.log("methodname:" + this.name);
}
});
outputs :
I20210126-08:35:30.120(0)? methodname:pod.create