-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMsgLogger.h
More file actions
35 lines (27 loc) · 822 Bytes
/
Copy pathMsgLogger.h
File metadata and controls
35 lines (27 loc) · 822 Bytes
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
//
// Created by yurik2004rus on 17.01.2026.
//
#ifndef MSGLOGGER_MSGLOGGER_H
#define MSGLOGGER_MSGLOGGER_H
#include <fstream>
#include <string>
enum ImportanceLevel {
INFO,
WARNING,
ERROR
};
class MsgLogger {
std::string fileName;
ImportanceLevel defaultLevel;
mutable std::ofstream fileStream;
static std::string getCurrentTime();
static std::string levelToString(ImportanceLevel level);
public:
MsgLogger(const std::string &fileName, ImportanceLevel defaultLevel);
void log(ImportanceLevel level, const std::string &message) const;
[[nodiscard]] std::string getFileName() const;
void setFileName(const std::string &name);
[[nodiscard]] ImportanceLevel getDefaultLevel() const;
void setDefaultLevel(ImportanceLevel level);
};
#endif //MSGLOGGER_MSGLOGGER_H