Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hello world AOP logger aspect
class LoggerAspect {
...
@afterMethod({
methodNamePattern: /^getNameByISBN$/,
classNamePattern: /^BookCollection$/
})
afterGetNameByISBN(meta) {
let result = meta.method.result;
Logger.info(`Retrieving ${result.isbn} - ${result.name} has been succeed`);
}
...
}
@Wove
class BookCollection {
...
getNameByISBN(id, article) {
return this.get({
isbn: isbn
}, {
cache: true,
onSuccess: 'name'
onFail: null
});
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment