Question: C + + please; A logger is a component of a codebase that prints to a stream what the code is doing. Write the implementation

C++ please;
A logger is a component of a codebase that prints to a stream what the code is doing. Write the implementation of the class Logger, whose header file is provided below:
#include
#include
using namespace std;
class Logger
{
private:
static int numOfLogs;
static int numOfWarns;
static int numOfErrs;
public:
static void log(string);
static void warn(string);
static void err(string);
static int getNumOfLogs();
static int getNumOfWarns();
static int getNumOfErrs();
static void resetNumOfLogs();
static void resetNumOfWarns();
static void resetNumOfErrs();
};
A Logger object can be used to print three kinds of messages: normal messages (logs), warnings, and errors.
The static data members numOfLogs, numOfWarns, and numOfErrs are used to keep track of how many messages of each type have been printed.
The log, warn, and err static function members should each print the string they receive, preceded by "[LOG]: ","[WRN]: ", and "[ERR]: " respectively, and followed by a newline. Remember to update the counting for each kind of message.
The reset functions should reset to 0 the counting for the corresponding kind of message.
Note: Make sure that your code includes the header file Logger.h.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!