Skip to content

jlopezxs/log-decorator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log-decorator

Logging decorator for Node and Browsers

Requirements and Use

npm install log-decorator --save

With Babel 7

babel.config.js

const plugins = [
    ['@babel/plugin-proposal-decorators', { 'legacy': true }]
]
module.exports = { plugins }

Use

import log from 'log-decorator';

class A {
  constructor() {}
  @log
  get(a,b,c) {
    return 3;
  }
}

new A().get({ a: 2 }, 2)

Output

$ get method called with [ { a: 2 }, 2 ]
$ get method returns 3

About

🔈 A simple logging decorator for all your funcions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published