Question: Create a library (or class) of logging functions (objects) that perform: Open a log file. Can be using a file descriptor, or stream or. Close

Create a library (or class) of logging functions (objects) that perform:

  1. Open a log file. Can be using a file descriptor, or stream or.
  2. Close a log file.
  3. Read the log file.
  4. Write to the log file
  5. Flush last write (e.g. commit the buffered write contents of the I/O buffer to the file)

The output lines of the log file shall include:

  1. Date/time.
  2. Line number.
  3. Contextual name (e.g. name of function when the log entry is being written).
  4. Type (e.g. warning, error, etc)
  5. Description of what is being logged.
  6. Other user fields as desired or deemed necessary.

The programming language shall be C or C++.

One trick that is sometimes used in logging output is to separate the fields using a delimiter such as the vertical pipe (|). This is my suggestion. This allows for the log lines to be imported into Excel or a database structure to make the log file text searchable.

To test, write a program of any sort and use the functions noted above to create and log information to a log file.

What is to be turned in:

  1. The source files.
  2. Screen print of the successful compilation.
  3. Screen print of the program run.
  4. The output log file.

Info: The structure should be a header file (*.h) with the function prototypes in it (or class objects prototypes) and a .c or .cpp file with the source code in it. This makes it reusable in other programs by providing the .h file and the .so (or dll) as an API for other programs to compile and link to. The whole point is to have reusable tool for logging funcitions.

Based upon a 100 point scale.

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 Databases Questions!