-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlogger.h
More file actions
38 lines (29 loc) · 830 Bytes
/
Copy pathlogger.h
File metadata and controls
38 lines (29 loc) · 830 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
36
37
38
#ifndef LOGGER_H
#define LOGGER_H
#include <string>
#include <chrono>
void log_error(std::string);
void log_warning(std::string);
void log_info(std::string);
void log_trace(std::string);
// logs a warning if instance lives longer than max_time
class log_warning_if_duration_exceeded {
public:
log_warning_if_duration_exceeded(std::string label, std::chrono::duration<double> max_time);
~log_warning_if_duration_exceeded();
private:
std::string label;
std::chrono::duration<double> max_time;
std::chrono::high_resolution_clock::time_point start_time;
};
// logs info on entry and exit of a scope
class log_entry_exit {
public:
log_entry_exit(std::string scope_label);
~log_entry_exit();
private:
std::string scope_label;
};
void log_backtrace();
void throw_and_log(std::string message);
#endif // LOGGER_H