SHARE
TWEET

Untitled

a guest Oct 21st, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* code sample using logger*/
  2. class CoffeeMaker
  3.   {
  4.     constructor(name)
  5.     {
  6.       this.logger=new JSLogger(this.constructor.name);
  7.     }
  8.     warmUp()
  9.     {
  10.       this.logger.info("Starting warm up... at",new Date());
  11.       this.logger.debug("Checking if the jar is placed properly");
  12.       this.logger.info("Done with warm up");
  13.     }
  14.     startHeater()
  15.     {
  16.       this.logger.debug("Checking if water is available in the reservoir");
  17.       this.logger.info("Starting the heater");
  18.       this.logger.info("Started the heater.");
  19.     }
  20.     startPumpingWater()
  21.     {
  22.       this.logger.info("Started the pump");
  23.       this.logger.warn("there might be water only for one cup.");
  24.       this.logger.error("the collecting jar is not in place.");
  25.     }
  26.     makeCoffee()
  27.     {
  28.       this.warmUp();
  29.       this.startHeater();
  30.       this.startPumpingWater();
  31.       this.logger.info("Done with making coffee");
  32.     }
  33.   }
  34.  
  35. let coffeeMaker=new CoffeeMaker("Kaushik's coffee maker");
  36. coffeeMaker.makeCoffee();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top