In this lab you will enhance the functionality of the server logging package so that it is more useful.
First, be sure you have the latest version of Thumper on your system. Do the following:
On the GitHub page for your fork of the Thumper project, fetch all upstream changes and merge them into your fork.
On your system, use the GitHub Desktop app to switch to the master branch of your Thumper repository and pull all changes to your system.
This two-step process will update the code on your machine to the latest version.
Next, create a branch in your clone for purposes of this change/enhancement to the code base. Branches like this are usually called topic branches. Call the branch something related to the change you intend to make: "lab07" or "server_logger" might be appropriate. The precise name is not critical, but keep in mind that in real life, you might have several topic branches going at once, so you want to choose names that will help you keep them straight.
After creating the branch switch to it (GitHub Desktop should do this automatically). Now load GNATstudio on the main Thumper project file thumper.gpr to start working.
Build and execute the Thumper server program (I recommend running it in a separate window). The only message it produces is a short informational message saying that it has connected to the database. The goal of this assignment is to enhance the logging facilities so that a timestamp is automatically added to each logged message and so that informational and warning messages can also be logged.
Study the code currently in the Server_Logger package. Add two additional procedures to this package using a similar style for writing informational messages (Write_Information) and warnings (Write_Warning).
Modify data_storage.adb so that instead of using Ada.Text_IO to display messages on the console, it uses the logger. Replace the two lines currently output with calls to Write_Information. This change focuses all server messages through a single logger package where such messages can be handled in a uniform way.
Study the specification of package Calendar in the Ada standard. Add a function to the body of the logger package called Format_Timestamp that returns the current date/time in this format: 2022-03-10 13:43:15. Notice that all timestamps have exactly the same length.
Use Format_Timestamp to prepend a timestamp on the front of every message produced by the logger. (Note that & is Ada's string concatenation operator).
Commit your changes to your branch and then push your branch to GitHub. This will add your branch to your fork of the main repository. In a later lab I will have you create a pull request on GitHub to contribute your changes back to the main Thumper repository. You don't need to do that now, however.
Submit your modified server_logger.adb file to Canvas. This lab is worth 20 points
Last Revised: 2022-03-10
© Copyright 2022 by Peter C. Chapin <pchapin@vtc.edu>