Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wilcorrea/f77bd26bcdd2408f62552082d3f182b7 to your computer and use it in GitHub Desktop.
Save wilcorrea/f77bd26bcdd2408f62552082d3f182b7 to your computer and use it in GitHub Desktop.
export default (enable = false) => {
function log (type, ...args) {
if (enable) {
console[type](this.$_id, ...args, Date.now(), this.$el)
}
}
return {
created () {
this.$_id = `${this.$options.name}-${this.$hashids.encode(Date.now())}`
},
methods: {
log (...args) {
log.call(this, 'log', ...args)
},
warn (...args) {
log.call(this, 'warn', ...args)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment