-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMAIN_LogClassDemo.cpp
More file actions
57 lines (42 loc) · 1.38 KB
/
MAIN_LogClassDemo.cpp
File metadata and controls
57 lines (42 loc) · 1.38 KB
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
#include "stdafx.h"
#include "LogClass.h"
#include <stdlib.h>
#include <iostream>
#include <string>
#include "stdlib.h"
#include "malloc.h"
using namespace std; // needed for console window and string class
LogClass Log;
FILE * pFile;
int main()
{
string directory = "./";
string file_name = "Log_file.txt";
int command_number;
Log.setup(directory, file_name);
cout << "testing the log class,file is at: \t " << directory << endl;
Log.write_line_with_timestamp("this line happened at this time");
Log.write_line_with_timestamp("and then this line happened after");
Log.write_line("This is a line without a timstamp");
Log.write_line("Here is another line without a timestamp");
Log.timestamp();
Log.append("\t a custom timestamp line by calling timestamp(), then append(), then newline()");
Log.newline();
Log.write_line(" now lets close the file, you can now edit the file on disk");
Log.close_log_file();
// tell user whats going on
cout << "The file is now closed and can be opened on disk, press any key to reopen file" << endl;
system("pause");
Log.reopen_log_file();
Log.write_line(" file re-opened! here is a new line");
cout << " a new line was added to the file" << endl;
Log.close_log_file();
cout << " if you want to delete the text file, enter 1" << endl;
cin >> command_number;
if (command_number == 1)
{
Log.delete_log_file();
}
system("pause");
return 0;
}