loggerutil.js 577 B

12345678910111213141516171819202122232425262728
  1. class LoggerUtil {
  2. constructor(prefix, style){
  3. this.prefix = prefix
  4. this.style = style
  5. }
  6. log(){
  7. console.log.apply(null, [this.prefix, this.style, ...arguments])
  8. }
  9. info(){
  10. console.info.apply(null, [this.prefix, this.style, ...arguments])
  11. }
  12. debug(){
  13. console.debug.apply(null, [this.prefix, this.style, ...arguments])
  14. }
  15. error(){
  16. console.error.apply(null, [this.prefix, this.style, ...arguments])
  17. }
  18. }
  19. module.exports = function (prefix, style){
  20. return new LoggerUtil(prefix, style)
  21. }