Exercise: Logging with Strategy
Practice how to create a logging component that accepts a strategy to define where the log messages are sent.
We'll cover the following
Problem statement
Implement a logging component having at least the following methods: debug()
, info()
, warn()
, and error()
. The logging component should also accept a strategy that defines where the log messages are sent. For example, we might have ConsoleStrategy
to send the messages to the console, or FileStrategy
to save the log messages to a file.
Coding challenge
Write your solution code in the following code widget. We’ve already added the package.json
file for your ease.
Get hands-on with 1400+ tech skills courses.