-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logger.cpp
85 lines (75 loc) · 2.15 KB
/
Logger.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/******************************************************************************/
/*!
\file Logger.cpp
\author Paul Huffman
\par email: huffmanp4\@nku.edu
\par Course: CSC402
\par Section: 001
\par Assignment: 3
\date 3/06/2022
\brief
This file contains the implementation of the logger class.
Functions included:
log()
getInstance()
Logger()
~Logger()
Hours spent on this assignment: 10
Specific portions that gave you the most trouble: Student
*/
/******************************************************************************/
#include <iostream>
#include "Logger.h"
/****************************************************************************/
/*!
\brief
This function will append the output parameter to the end of the logger.
\param output
This is a string that will be printed by the logger class.
*/
/****************************************************************************/
void Logger::log(const std::string& output) {
fullLog.append(output);
//std::cout<<output;
}
/****************************************************************************/
/*!
\brief
This function will return a reference to a logger.
\return
This is the reference to a logger that will be returned.
*/
/****************************************************************************/
Logger &Logger::getInstance() {
static Logger instance;
return instance;
}
/****************************************************************************/
/*!
\brief
This is the default constructor fot the logger class. It is private.
*/
/****************************************************************************/
Logger::Logger() {
/*logFile.open("LogFile.txt");
if(!logFile.is_open())
{
std::cout<<"LogFile couldn't be opened."<<std::endl;
}
*/
fullLog = "";
}
/****************************************************************************/
/*!
\brief
This is the destructor for the logger class. It will print the log to
the screen.
*/
/****************************************************************************/
Logger::~Logger() {
/*if(logFile)
{
logFile.close();
}*/
std::cout<<fullLog<<std::endl;
}