Skip to content

Instantly share code, notes, and snippets.

@patrickarlt
Created August 25, 2015 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickarlt/713e858568080800eb00 to your computer and use it in GitHub Desktop.
Save patrickarlt/713e858568080800eb00 to your computer and use it in GitHub Desktop.
export default function log (target, name, descriptor) {
let fn = descriptor.value;
descriptor.value = function (...args) {
console.log('calling', name, 'with', args);
try {
let out = fn.apply(this, args);
console.log('got', out);
return out;
} catch (e) {
console.log('caught', e.message);
throw e;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment