Question: The Super - Duper Amazing Operating System 2 . 0 has a logging facility that applications can use to log messages to the Operating System's
The SuperDuper Amazing Operating System has a logging facility that applications can use to log messages to the Operating System's log files. The programming interface is odd.
Logging the message requires the application programming to build a structure that has two fields: an integer enumeration that indicates the severity of a event. This enum defines four values: SEVERE, ERROR, WARNING, INFO. The second field in the structure is a CString that has the text of the error message. One logs a message to the log file by creating one of these structures, filling the appropriate values, and then passing a pointer to the structure to the SDAOS logging function. The source code at the end of this question shows the C interface for this API.
Using the Singleton and Facade patterns, write a class in C that an application can use as a central point to log errors in the operating system. You class needs to be designed in a manner that an app client need only call one function for each of the four log message types, passing a C string object to the function.
HINTS:
This problem requires you to apply the Facade pattern twice. Once for the API and then again on how to test this code if you aren't running on the SuperDuper Amazing Operating System.
Think carefully about the interface between the C String classes and the CString data type.
enum class ErrorLevel SEVERE ERROR, WARNING, INFO;
struct ErrorContext
ErrorLevel errlevel;
const char logmsg;
logcontext;
extern void SDAOSloggerstruct ErrorContext &logcontext;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
