-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (38 loc) · 1.27 KB
/
Copy pathmain.cpp
File metadata and controls
47 lines (38 loc) · 1.27 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
#include <iostream>
#include "src/BufferedLogger.h"
int main() {
std::string file_name{};
int buffer_size{};
std::cout << "Enter log file name" << '\n';
std::cin >> file_name;
std::cout << "Enter buffer size" << '\n';
std::cin >> buffer_size;
auto logger = logger::BufferedLogger(file_name, buffer_size);
while (true) {
int log_number{};
bool condition{};
std::cout << "Enter the number of logs to generate:" << '\n';
std::cin >> log_number;
for (int i{}; i < log_number; i++)
logger.write_log("New log");
std::cout << "Do you wanna write block? (0 - no)" << '\n';
std::cin >> condition;
if (condition) {
int curr_block_size{};
std::cout << "Enter current block size: " << '\n';
std::cin >> curr_block_size;
logger.write_block_to_file(curr_block_size);
condition = false;
}
std::cout << "Do you wanna clear buffer? (0 - no)" << '\n';
std::cin >> condition;
if (condition) {
logger.flush_log();
condition = false;
}
std::cout << "Do you wanna exit? (0 - no)" << '\n';
std::cin >> condition;
if (condition)
break;
}
}