The First Lab, Logging and Functions PBV



File Logging is a common method of finding errors in code. Many applications that run in the background for an operating system use file logging
Linux has the /var/log/ directory that contains operational logs from countless applications running right now on this server.
Windows system have a built in event log and the Event Viewer application to read the logged messages.

We will primarily be using logging to provide diagnostic information about the code you will be writing.


there are logging functions provided for you in the cmpslib.h

REQUIREMENTS:
    1. You must include the logging library functions.... #include "cmpslib.h"
    2. You must define the logging struct above your main....  struct LOGGER_DATA LG_DATA;
       this should be done in the main file for a few reasons, it is only needed when it actually runs, not for compilation,
       there can be only one instance in any runable file. so ONLY put this in your main file.

    3. You must call LoggerSetUpLog(string filename) at the beginning of you main and before using any other logging functions or macros. only call it once.

    4. For any files where you would like to use the logging macros or functions you will want to include "cmpslib.h"

    5. Since the logging functions use a variadic templates you will need to compile code that uses it with the option "-std=c++11" this should be taken care of for you with the provided Makefile.

    6. For the indentation in the file to show function nesting properly you must log the start and end of every function, otherwise the format of the logfile will not look correct.




LOOK AT THE LOGGING EXAMPLES before starting this lab, the link is on the main class page


for all your labs and homeword assignments you will need to create a special directory to create your assignments directory run the following script /home/fac/msarr/public_files/create_assignments_script.sh this will prompt you for your login credentials it will then create all your directories for you homework and labs to be completed in MAKE SURE YOUR DIRECTORY HAS THE CORRECT PERMISSIONS BEFORE CONTINUING on the command line run " ls -lah ~ | grep assignments " it should not have the text student anywhere on the line that this command displays, if so stop right here and ask for help cd to the lab01 folder cd ~/assignments/cmps2020/lab/lab01/ this is where you will do your work for lab 1 copy all the files over from /home/fac/msarr/public_files/cmps2020/lab/lab01/ you can do that with the following cp -r /home/fac/msarr/public_files/cmps2020/lab/lab01/* /home/stu/YOURUSERNAME/assignments/cmps2020/lab/lab01/ or ( note the . instead of the destination folder, it means "this directory") cp -r /home/fac/msarr/public_files/cmps2020/lab/lab01/* . for this lab you will create some Pass By Value functions LOG THE BEGINNING AND END OF EVERY FUNCTION SmallerInt determine the smaller of two integer values passed in as parameters 1 and 2 return the result LargerInt determine the larger of two integer values passed in as parameters 1 and 2 return the result Just modify the existing main1.cpp provided for you , you will add in your functions and test them. in "main.cpp" you will test call all your functions to make sure they work properly is is 100% your responsibility to make sure that the functions you write work properly your tests should print the test "fail" if the function is not operation properly TEST EACH FUNCTION AT LEAST 4 TIMES for example BAD TripleInt(3) calculates the value of 9 TripleInt(4) calculates the value of 12 TripleInt(-5) calculates the value of 15 GOOD TripleInt(3) PASS TripleInt(4) PASS TripleInt(-5) FAIL make sure your code compiles, you can test with the following make clean make ./runme1 run the example and make sure your logging is similar to the example once you are sure your code compiles, runs as expected and logs as expected you can have your lab graded for credit If you would like full credit Implement logging for the start and end ( at the very LEAST) on all your functions test each of your functions by calling them 4 times each with different values each time.