Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* code sample using logger*/
- class CoffeeMaker
- {
- constructor(name)
- {
- this.logger=new JSLogger(this.constructor.name);
- }
- warmUp()
- {
- this.logger.info("Starting warm up... at",new Date());
- this.logger.debug("Checking if the jar is placed properly");
- this.logger.info("Done with warm up");
- }
- startHeater()
- {
- this.logger.debug("Checking if water is available in the reservoir");
- this.logger.info("Starting the heater");
- this.logger.info("Started the heater.");
- }
- startPumpingWater()
- {
- this.logger.info("Started the pump");
- this.logger.warn("there might be water only for one cup.");
- this.logger.error("the collecting jar is not in place.");
- }
- makeCoffee()
- {
- this.warmUp();
- this.startHeater();
- this.startPumpingWater();
- this.logger.info("Done with making coffee");
- }
- }
- let coffeeMaker=new CoffeeMaker("Kaushik's coffee maker");
- coffeeMaker.makeCoffee();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement