-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRedLog.h
114 lines (99 loc) · 2.94 KB
/
RedLog.h
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* @file RedLog.h
* @brief RedLog is a lib which serves to make notes of running your programs.
* Copyright (c) 2020-forever Vlad Rogozin ([email protected])
*
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
* or copy at http://opensource.org/licenses/MIT)
*/
#ifndef RED_LOG_H
#define RED_LOG_H
#include <string>
#include <fstream>
#define REDLOG_VERSION "1.1"
#define REDLOG_NO_GROUP "redlog null group"
namespace Red {
class RedLog {
private:
// Connection to log file.
std::ofstream m_LogFile;
public:
/**
* @brief RedLog
*
* Base ctor.
*/
RedLog();
/**
* @brief RedLog
*
* Ctor.
*
* @param path Path to log file.
*/
RedLog(std::string& path);
/**
* @brief OpenFile
*
* Uses to open log file.
*
* @param path Path to log file.
*/
void OpenFile(std::string& path);
/**
* @brief FileExists
*
* Uses to check log file for existance.
*
* @param path Path to log file.
*
* @return True if log file exists, false if not.
*/
static bool FileExists(std::string& path);
/**
* @brief CreateLogFile
*
* Uses to create log file.
*
* @param path Path to log file.
*
* @return True if file was created, false if not.
*/
static bool CreateLogFile(std::string& path);
/**
* @brief DeleteFile
*
* Uses to delete log file.
*
* @param path Path to log file.
*
* @return True if file was deleted successfully, false if not.
*/
static bool DeleteFile(std::string& path);
/**
* @brief NewNote
*
* Uses to add new line to log file.
*
* Date and time will be added automatically.
*
* @param group Group of module you logging.
* @param note String which will be added to log file.
*/
void NewNote(std::string *group, std::string *note);
/**
* @brief NewNote
*
* Uses to add new line to log file.
*
* Date and time will be added automatically.
*
* @param group Group of module you logging.
* @param note String which will be added to log file.
*/
void NewNote(std::string group, std::string note);
// Base dtor.
~RedLog() {}
};
}
#endif // RED_LOG_H