-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathError.h
35 lines (29 loc) · 907 Bytes
/
Error.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
#ifndef ERROR_H
#define ERROR_H
#include <iostream>
#include <memory>
#include "Chron.h"
#include "Print.h"
#include "Log.h"
class Error {
public:
const uint16_t errorCode;
const std::string objectID;
std::chrono::system_clock::time_point timestamp;
Error(const uint16_t code, const std::string id,
std::chrono::system_clock::time_point timestamp)
: errorCode(code), objectID(id), timestamp(timestamp) {}
void print(void) {
Printer errorPrinter;
errorPrinter.print("Error: code: ", errorCode);
errorPrinter.print(" id: ", objectID);
errorPrinter.print(" time: ", Chron::timeToString(timestamp));
};
void log(void) {
Logger errorLogger;
errorLogger.log("Error: code: ", errorCode);
errorLogger.log(" id: ", objectID);
errorLogger.log(" time: ", Chron::timeToString(timestamp));
};
};
#endif