In a language of your choice, implement the following things:
Make an interface, called MyLogger with only 1 method - log(level, message)
The two arguments should be:
level- an integer, from 1 to 3.- 1 means that your are logging with
INFOlevel. - 2 means that you are logging with
WARNINGlevel. - 3 means that you are logging with
PLSCHECKFFSlevel. messageis a string, that you are logging.
There is a rule of how to make the log message, regardless where you are saving it:
{LOG_LEVEL_STRING}::{TIMESTAMP}::{MESSAGE}
For example, if we log with level = 1, and message = "Hello World", this will produce the following line:
INFO::2015-02-02T01:43:19+00:00::Hello World
The timestamp should be in ISO 8901 format.
Make 3 different classes, that implement the interface MyLogger:
The ConsoleLogger should log the messages directly to the console.
The FileLogger should log the messages to a given file.
The HTTPLogger shoud log the messages via a POST request to a given HTTP url.
For each logger, make sure to include examples - scripts or tests that show how the logging works.