课程: JavaScript: Five Advanced Challenges and Concepts

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Solution: Create a logging system

Solution: Create a logging system

(bright music) - [Instructor] In this challenge, we're creating a basic logger system using a singleton and a proxy, and looking down at the test code you'll see all we want to do is enter these log entries user Maikan was created, user Simran was created Simran was updated, and Maikan was deleted. And then for each just output information about when that happened. Looking at the code here, you'll see at the bottom we're returning this logger that is a new proxy of logger instance and we have a handler function and the bare bones of this is already built out. We have a class called Logger that currently has nothing in it. We have a logger instance for a new logger, so that would be the logger instance that's referenced down here. And we have a constant called handler for the handling object. So we need to build out all of these pieces. There are two key pieces here. One is logger needs to create a singleton instance…

内容